commit b4d684a84c264ebdc5194d6ee5a809e62e0b1577 Author: XuJiacheng Date: Fri Nov 21 08:48:01 2025 +0800 初始化 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..647f98c --- /dev/null +++ b/.gitignore @@ -0,0 +1,88 @@ +/.vs +/BLWLogServer/obj +/BLWLogServer/bin +/DAL/obj +/DAL/bin +/BLWLogProduce/obj +/BLWLogProduce/bin +/CommonEntity/obj +/CommonEntity/bin +/CommonTools/obj +/CommonTools/bin +/UseSQLQueryData/obj +/UseSQLQueryData/bin +/心跳维持/obj +/心跳维持/bin +/guolv/obj +/guolv/bin +/UseSQLQueryData/NLog.xsd +/BLWLogServer/Properties/PublishProfiles +/BLWLogProduce/Properties/PublishProfiles + + + +/ClassLibrary1/obj +/ClassLibrary1/bin + +/ClassLibrary2/obj +/ClassLibrary2/bin + +/ClassLibrary3/obj +/ClassLibrary3/bin + +/ConsoleApp1/obj +/ConsoleApp1/bin + +/ConsoleApp2/obj +/ConsoleApp2/bin + +/ConsoleApp3/obj +/ConsoleApp3/bin + + +/消费/obj +/消费/bin + +/心跳维持/obj +/心跳维持/bin + +/回收/obj +/回收/bin + +/duoge/obj +/duoge/bin + + +/FanShe/obj +/FanShe/obj +/Faster/obj +/Faster/obj +/FasterClient/obj +/FasterClient/obj +/MyFaster/bin +/MyFaster/bin +/MyFunctioncache/bin +/MyFunctioncache/bin +/MyNLua/bin +/MyNLua/bin + +/guolv/obj +/guolv/bin +/MMMEEE/obj +/MMMEEE/bin + + + +/消费/obj +/回收/obj +/Faster/obj +/MyFaster/obj +/Faster/obj +/Faster/bin +/MyFaster/bin +/MyFunctioncache/obj +/MyFunctioncache/bin +/mypwsh/obj +/mypwsh/bin +/回收/bin +/消费/bin diff --git a/BLWLogProduce/.config/dotnet-tools.json b/BLWLogProduce/.config/dotnet-tools.json new file mode 100644 index 0000000..fa9cd18 --- /dev/null +++ b/BLWLogProduce/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "9.0.7", + "commands": [ + "dotnet-ef" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/BLWLogProduce/2.txt b/BLWLogProduce/2.txt new file mode 100644 index 0000000..b786ae0 --- /dev/null +++ b/BLWLogProduce/2.txt @@ -0,0 +1,55 @@ +# HELP UDP_Upload Total bytes uploaded via UDP. +# TYPE UDP_Upload gauge +UDP_Upload 333 + +# HELP UDP_Sent Total UDP packets sent. +# TYPE UDP_Sent gauge +UDP_Sent 0 + +# HELP RCU_Online Current number of online RCU units. +# TYPE RCU_Online gauge +RCU_Online 0 + +# HELP RCU_TakeCard Total number of card take operations performed by RCU units. +# TYPE RCU_TakeCard gauge +RCU_TakeCard 0 + +# HELP RCU_Heart Total number of heartbeats received from RCU units. +# TYPE RCU_Heart gauge +RCU_Heart 0 + +# HELP RCU_SearchHost Total number of host search operations performed by RCU units. +# TYPE RCU_SearchHost gauge +RCU_SearchHost 0 + +# HELP Intercept Number of intercept operations or intercepted items. +# TYPE Intercept gauge +Intercept 0 + +# HELP WebUser Number of active web users currently connected. +# TYPE WebUser gauge +WebUser 0 + +# HELP Energy Current energy consumption or energy level. +# TYPE Energy gauge +Energy 0 + +# HELP RCU_0E Number of RCU units with type 0E status. +# TYPE RCU_0E gauge +RCU_OE 0 + +# HELP TCL_Ctr Control counter or status for TCL devices. +# TYPE TCL_Ctr gauge +TCL_Ctr 0 + +# HELP TM_Ctr Control counter or status for TM devices. +# TYPE TM_Ctr gauge +TM_Ctr 0 + +# HELP XD_Ctr Control counter or status for XD devices. +# TYPE XD_Ctr gauge +XD_Ctr 0 + +# HELP Hivi_Ctr Control counter or status for Hivi devices. +# TYPE Hivi_Ctr gauge +Hivi_Ctr 0 diff --git a/BLWLogProduce/BLWLogProduce.csproj b/BLWLogProduce/BLWLogProduce.csproj new file mode 100644 index 0000000..ee675b4 --- /dev/null +++ b/BLWLogProduce/BLWLogProduce.csproj @@ -0,0 +1,30 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + + diff --git a/BLWLogProduce/BLWLogProduce.csproj.user b/BLWLogProduce/BLWLogProduce.csproj.user new file mode 100644 index 0000000..8ecb7ff --- /dev/null +++ b/BLWLogProduce/BLWLogProduce.csproj.user @@ -0,0 +1,12 @@ + + + + http + ApiControllerEmptyScaffolder + root/Common/Api + E:\tian\BLS\BLWLogServer\BLWLogProduce\Properties\PublishProfiles\FolderProfile.pubxml + + + ProjectDebugger + + \ No newline at end of file diff --git a/BLWLogProduce/BLWLogProduce.http b/BLWLogProduce/BLWLogProduce.http new file mode 100644 index 0000000..9b63594 --- /dev/null +++ b/BLWLogProduce/BLWLogProduce.http @@ -0,0 +1,6 @@ +@BLWLogProduce_HostAddress = http://localhost:5092 + +GET {{BLWLogProduce_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/BLWLogProduce/Controllers/HeartBeatController.cs b/BLWLogProduce/Controllers/HeartBeatController.cs new file mode 100644 index 0000000..aeeda8c --- /dev/null +++ b/BLWLogProduce/Controllers/HeartBeatController.cs @@ -0,0 +1,23 @@ +using BLWLogProduce.Services; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace BLWLogProduce.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class HeartBeatController : ControllerBase + { + [HttpPost()] + public string Heart() + { + return "hello"; + } + + [HttpPost()] + public string getlocation(string ip) + { + return KafkaProduce.GetBaiduIp(ip); + } + } +} diff --git a/BLWLogProduce/Controllers/WeatherForecastController.cs b/BLWLogProduce/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..8b3fd5b --- /dev/null +++ b/BLWLogProduce/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BLWLogProduce.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} diff --git a/BLWLogProduce/EnergyConsumption.cs b/BLWLogProduce/EnergyConsumption.cs new file mode 100644 index 0000000..6f64b66 --- /dev/null +++ b/BLWLogProduce/EnergyConsumption.cs @@ -0,0 +1,1332 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: EnergyConsumption.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace BLWData.Entity { + + /// Holder for reflection information generated from EnergyConsumption.proto + public static partial class EnergyConsumptionReflection { + + #region Descriptor + /// File descriptor for EnergyConsumption.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static EnergyConsumptionReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChdFbmVyZ3lDb25zdW1wdGlvbi5wcm90bxIOQkxXRGF0YS5FbnRpdHkivgEK", + "CkRldmljZURhdGESDgoGSG9zdElEGAEgASgDEhIKCkRldmljZVR5cGUYAiAB", + "KAkSDwoHQWRkcmVzcxgDIAEoCRIOCgZTdGF0dXMYBCABKAUSEgoKQnJpZ2h0", + "bmVzcxgFIAEoBRITCgtDdXJyZW50VGVtcBgGIAEoBRITCgtTZXR0aW5nVGVt", + "cBgHIAEoBRIQCghGYW5TcGVlZBgIIAEoBRIMCgRNb2RlGAkgASgFEg0KBVZh", + "bHZlGAogASgFIuICChFFbmVyZ3lDb25zdW1wdGlvbhIRCglIb3RlbENvZGUY", + "ASABKAMSEgoKSG9zdE51bWJlchgCIAEoCRILCgNNYWMYAyABKAkSEAoIRW5k", + "UG9pbnQYBCABKAkSDwoHVmVyc2lvbhgFIAEoCRISCgpJc1Rha2VDYXJkGAYg", + "ASgIEgkKAVYYByABKAESCQoBQRgIIAEoARIJCgFQGAkgASgBEhoKEkVuZXJn", + "eV9Db25zdW1wdGlvbhgKIAEoARIeChZTdW1fRW5lcmd5X0NvbnN1bXB0aW9u", + "GAsgASgBEhIKCkNyZWF0ZVRpbWUYDCABKAMSEgoKUm9vbU51bWJlchgNIAEo", + "CRIRCglDYXJib25WSVAYDiABKAUSFAoMSWRlbnRpdHlJbmZvGA8gASgFEjQK", + "EERldmljZVN0YXR1c0xpc3QYECADKAsyGi5CTFdEYXRhLkVudGl0eS5EZXZp", + "Y2VEYXRhYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::BLWData.Entity.DeviceData), global::BLWData.Entity.DeviceData.Parser, new[]{ "HostID", "DeviceType", "Address", "Status", "Brightness", "CurrentTemp", "SettingTemp", "FanSpeed", "Mode", "Valve" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::BLWData.Entity.EnergyConsumption), global::BLWData.Entity.EnergyConsumption.Parser, new[]{ "HotelCode", "HostNumber", "Mac", "EndPoint", "Version", "IsTakeCard", "V", "A", "P", "EnergyConsumption_", "SumEnergyConsumption", "CreateTime", "RoomNumber", "CarbonVIP", "IdentityInfo", "DeviceStatusList" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class DeviceData : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeviceData()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::BLWData.Entity.EnergyConsumptionReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceData() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceData(DeviceData other) : this() { + hostID_ = other.hostID_; + deviceType_ = other.deviceType_; + address_ = other.address_; + status_ = other.status_; + brightness_ = other.brightness_; + currentTemp_ = other.currentTemp_; + settingTemp_ = other.settingTemp_; + fanSpeed_ = other.fanSpeed_; + mode_ = other.mode_; + valve_ = other.valve_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceData Clone() { + return new DeviceData(this); + } + + /// Field number for the "HostID" field. + public const int HostIDFieldNumber = 1; + private long hostID_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long HostID { + get { return hostID_; } + set { + hostID_ = value; + } + } + + /// Field number for the "DeviceType" field. + public const int DeviceTypeFieldNumber = 2; + private string deviceType_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string DeviceType { + get { return deviceType_; } + set { + deviceType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Address" field. + public const int AddressFieldNumber = 3; + private string address_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Address { + get { return address_; } + set { + address_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Status" field. + public const int StatusFieldNumber = 4; + private int status_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Status { + get { return status_; } + set { + status_ = value; + } + } + + /// Field number for the "Brightness" field. + public const int BrightnessFieldNumber = 5; + private int brightness_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Brightness { + get { return brightness_; } + set { + brightness_ = value; + } + } + + /// Field number for the "CurrentTemp" field. + public const int CurrentTempFieldNumber = 6; + private int currentTemp_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CurrentTemp { + get { return currentTemp_; } + set { + currentTemp_ = value; + } + } + + /// Field number for the "SettingTemp" field. + public const int SettingTempFieldNumber = 7; + private int settingTemp_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int SettingTemp { + get { return settingTemp_; } + set { + settingTemp_ = value; + } + } + + /// Field number for the "FanSpeed" field. + public const int FanSpeedFieldNumber = 8; + private int fanSpeed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int FanSpeed { + get { return fanSpeed_; } + set { + fanSpeed_ = value; + } + } + + /// Field number for the "Mode" field. + public const int ModeFieldNumber = 9; + private int mode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Mode { + get { return mode_; } + set { + mode_ = value; + } + } + + /// Field number for the "Valve" field. + public const int ValveFieldNumber = 10; + private int valve_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Valve { + get { return valve_; } + set { + valve_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DeviceData); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DeviceData other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HostID != other.HostID) return false; + if (DeviceType != other.DeviceType) return false; + if (Address != other.Address) return false; + if (Status != other.Status) return false; + if (Brightness != other.Brightness) return false; + if (CurrentTemp != other.CurrentTemp) return false; + if (SettingTemp != other.SettingTemp) return false; + if (FanSpeed != other.FanSpeed) return false; + if (Mode != other.Mode) return false; + if (Valve != other.Valve) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HostID != 0L) hash ^= HostID.GetHashCode(); + if (DeviceType.Length != 0) hash ^= DeviceType.GetHashCode(); + if (Address.Length != 0) hash ^= Address.GetHashCode(); + if (Status != 0) hash ^= Status.GetHashCode(); + if (Brightness != 0) hash ^= Brightness.GetHashCode(); + if (CurrentTemp != 0) hash ^= CurrentTemp.GetHashCode(); + if (SettingTemp != 0) hash ^= SettingTemp.GetHashCode(); + if (FanSpeed != 0) hash ^= FanSpeed.GetHashCode(); + if (Mode != 0) hash ^= Mode.GetHashCode(); + if (Valve != 0) hash ^= Valve.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HostID != 0L) { + output.WriteRawTag(8); + output.WriteInt64(HostID); + } + if (DeviceType.Length != 0) { + output.WriteRawTag(18); + output.WriteString(DeviceType); + } + if (Address.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Address); + } + if (Status != 0) { + output.WriteRawTag(32); + output.WriteInt32(Status); + } + if (Brightness != 0) { + output.WriteRawTag(40); + output.WriteInt32(Brightness); + } + if (CurrentTemp != 0) { + output.WriteRawTag(48); + output.WriteInt32(CurrentTemp); + } + if (SettingTemp != 0) { + output.WriteRawTag(56); + output.WriteInt32(SettingTemp); + } + if (FanSpeed != 0) { + output.WriteRawTag(64); + output.WriteInt32(FanSpeed); + } + if (Mode != 0) { + output.WriteRawTag(72); + output.WriteInt32(Mode); + } + if (Valve != 0) { + output.WriteRawTag(80); + output.WriteInt32(Valve); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HostID != 0L) { + output.WriteRawTag(8); + output.WriteInt64(HostID); + } + if (DeviceType.Length != 0) { + output.WriteRawTag(18); + output.WriteString(DeviceType); + } + if (Address.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Address); + } + if (Status != 0) { + output.WriteRawTag(32); + output.WriteInt32(Status); + } + if (Brightness != 0) { + output.WriteRawTag(40); + output.WriteInt32(Brightness); + } + if (CurrentTemp != 0) { + output.WriteRawTag(48); + output.WriteInt32(CurrentTemp); + } + if (SettingTemp != 0) { + output.WriteRawTag(56); + output.WriteInt32(SettingTemp); + } + if (FanSpeed != 0) { + output.WriteRawTag(64); + output.WriteInt32(FanSpeed); + } + if (Mode != 0) { + output.WriteRawTag(72); + output.WriteInt32(Mode); + } + if (Valve != 0) { + output.WriteRawTag(80); + output.WriteInt32(Valve); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HostID != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(HostID); + } + if (DeviceType.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(DeviceType); + } + if (Address.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Address); + } + if (Status != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Status); + } + if (Brightness != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Brightness); + } + if (CurrentTemp != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(CurrentTemp); + } + if (SettingTemp != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(SettingTemp); + } + if (FanSpeed != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(FanSpeed); + } + if (Mode != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Mode); + } + if (Valve != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Valve); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DeviceData other) { + if (other == null) { + return; + } + if (other.HostID != 0L) { + HostID = other.HostID; + } + if (other.DeviceType.Length != 0) { + DeviceType = other.DeviceType; + } + if (other.Address.Length != 0) { + Address = other.Address; + } + if (other.Status != 0) { + Status = other.Status; + } + if (other.Brightness != 0) { + Brightness = other.Brightness; + } + if (other.CurrentTemp != 0) { + CurrentTemp = other.CurrentTemp; + } + if (other.SettingTemp != 0) { + SettingTemp = other.SettingTemp; + } + if (other.FanSpeed != 0) { + FanSpeed = other.FanSpeed; + } + if (other.Mode != 0) { + Mode = other.Mode; + } + if (other.Valve != 0) { + Valve = other.Valve; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + HostID = input.ReadInt64(); + break; + } + case 18: { + DeviceType = input.ReadString(); + break; + } + case 26: { + Address = input.ReadString(); + break; + } + case 32: { + Status = input.ReadInt32(); + break; + } + case 40: { + Brightness = input.ReadInt32(); + break; + } + case 48: { + CurrentTemp = input.ReadInt32(); + break; + } + case 56: { + SettingTemp = input.ReadInt32(); + break; + } + case 64: { + FanSpeed = input.ReadInt32(); + break; + } + case 72: { + Mode = input.ReadInt32(); + break; + } + case 80: { + Valve = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + HostID = input.ReadInt64(); + break; + } + case 18: { + DeviceType = input.ReadString(); + break; + } + case 26: { + Address = input.ReadString(); + break; + } + case 32: { + Status = input.ReadInt32(); + break; + } + case 40: { + Brightness = input.ReadInt32(); + break; + } + case 48: { + CurrentTemp = input.ReadInt32(); + break; + } + case 56: { + SettingTemp = input.ReadInt32(); + break; + } + case 64: { + FanSpeed = input.ReadInt32(); + break; + } + case 72: { + Mode = input.ReadInt32(); + break; + } + case 80: { + Valve = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + /// + /// 定义一个Person消息类型 + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class EnergyConsumption : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnergyConsumption()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::BLWData.Entity.EnergyConsumptionReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnergyConsumption() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnergyConsumption(EnergyConsumption other) : this() { + hotelCode_ = other.hotelCode_; + hostNumber_ = other.hostNumber_; + mac_ = other.mac_; + endPoint_ = other.endPoint_; + version_ = other.version_; + isTakeCard_ = other.isTakeCard_; + v_ = other.v_; + a_ = other.a_; + p_ = other.p_; + energyConsumption_ = other.energyConsumption_; + sumEnergyConsumption_ = other.sumEnergyConsumption_; + createTime_ = other.createTime_; + roomNumber_ = other.roomNumber_; + carbonVIP_ = other.carbonVIP_; + identityInfo_ = other.identityInfo_; + deviceStatusList_ = other.deviceStatusList_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnergyConsumption Clone() { + return new EnergyConsumption(this); + } + + /// Field number for the "HotelCode" field. + public const int HotelCodeFieldNumber = 1; + private long hotelCode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long HotelCode { + get { return hotelCode_; } + set { + hotelCode_ = value; + } + } + + /// Field number for the "HostNumber" field. + public const int HostNumberFieldNumber = 2; + private string hostNumber_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HostNumber { + get { return hostNumber_; } + set { + hostNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Mac" field. + public const int MacFieldNumber = 3; + private string mac_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Mac { + get { return mac_; } + set { + mac_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "EndPoint" field. + public const int EndPointFieldNumber = 4; + private string endPoint_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string EndPoint { + get { return endPoint_; } + set { + endPoint_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Version" field. + public const int VersionFieldNumber = 5; + private string version_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Version { + get { return version_; } + set { + version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "IsTakeCard" field. + public const int IsTakeCardFieldNumber = 6; + private bool isTakeCard_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsTakeCard { + get { return isTakeCard_; } + set { + isTakeCard_ = value; + } + } + + /// Field number for the "V" field. + public const int VFieldNumber = 7; + private double v_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double V { + get { return v_; } + set { + v_ = value; + } + } + + /// Field number for the "A" field. + public const int AFieldNumber = 8; + private double a_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double A { + get { return a_; } + set { + a_ = value; + } + } + + /// Field number for the "P" field. + public const int PFieldNumber = 9; + private double p_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double P { + get { return p_; } + set { + p_ = value; + } + } + + /// Field number for the "Energy_Consumption" field. + public const int EnergyConsumption_FieldNumber = 10; + private double energyConsumption_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double EnergyConsumption_ { + get { return energyConsumption_; } + set { + energyConsumption_ = value; + } + } + + /// Field number for the "Sum_Energy_Consumption" field. + public const int SumEnergyConsumptionFieldNumber = 11; + private double sumEnergyConsumption_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double SumEnergyConsumption { + get { return sumEnergyConsumption_; } + set { + sumEnergyConsumption_ = value; + } + } + + /// Field number for the "CreateTime" field. + public const int CreateTimeFieldNumber = 12; + private long createTime_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long CreateTime { + get { return createTime_; } + set { + createTime_ = value; + } + } + + /// Field number for the "RoomNumber" field. + public const int RoomNumberFieldNumber = 13; + private string roomNumber_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string RoomNumber { + get { return roomNumber_; } + set { + roomNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "CarbonVIP" field. + public const int CarbonVIPFieldNumber = 14; + private int carbonVIP_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CarbonVIP { + get { return carbonVIP_; } + set { + carbonVIP_ = value; + } + } + + /// Field number for the "IdentityInfo" field. + public const int IdentityInfoFieldNumber = 15; + private int identityInfo_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int IdentityInfo { + get { return identityInfo_; } + set { + identityInfo_ = value; + } + } + + /// Field number for the "DeviceStatusList" field. + public const int DeviceStatusListFieldNumber = 16; + private static readonly pb::FieldCodec _repeated_deviceStatusList_codec + = pb::FieldCodec.ForMessage(130, global::BLWData.Entity.DeviceData.Parser); + private readonly pbc::RepeatedField deviceStatusList_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField DeviceStatusList { + get { return deviceStatusList_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as EnergyConsumption); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(EnergyConsumption other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HotelCode != other.HotelCode) return false; + if (HostNumber != other.HostNumber) return false; + if (Mac != other.Mac) return false; + if (EndPoint != other.EndPoint) return false; + if (Version != other.Version) return false; + if (IsTakeCard != other.IsTakeCard) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(V, other.V)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(A, other.A)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(P, other.P)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(EnergyConsumption_, other.EnergyConsumption_)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(SumEnergyConsumption, other.SumEnergyConsumption)) return false; + if (CreateTime != other.CreateTime) return false; + if (RoomNumber != other.RoomNumber) return false; + if (CarbonVIP != other.CarbonVIP) return false; + if (IdentityInfo != other.IdentityInfo) return false; + if(!deviceStatusList_.Equals(other.deviceStatusList_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HotelCode != 0L) hash ^= HotelCode.GetHashCode(); + if (HostNumber.Length != 0) hash ^= HostNumber.GetHashCode(); + if (Mac.Length != 0) hash ^= Mac.GetHashCode(); + if (EndPoint.Length != 0) hash ^= EndPoint.GetHashCode(); + if (Version.Length != 0) hash ^= Version.GetHashCode(); + if (IsTakeCard != false) hash ^= IsTakeCard.GetHashCode(); + if (V != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(V); + if (A != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(A); + if (P != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(P); + if (EnergyConsumption_ != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(EnergyConsumption_); + if (SumEnergyConsumption != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(SumEnergyConsumption); + if (CreateTime != 0L) hash ^= CreateTime.GetHashCode(); + if (RoomNumber.Length != 0) hash ^= RoomNumber.GetHashCode(); + if (CarbonVIP != 0) hash ^= CarbonVIP.GetHashCode(); + if (IdentityInfo != 0) hash ^= IdentityInfo.GetHashCode(); + hash ^= deviceStatusList_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HotelCode != 0L) { + output.WriteRawTag(8); + output.WriteInt64(HotelCode); + } + if (HostNumber.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HostNumber); + } + if (Mac.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Mac); + } + if (EndPoint.Length != 0) { + output.WriteRawTag(34); + output.WriteString(EndPoint); + } + if (Version.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Version); + } + if (IsTakeCard != false) { + output.WriteRawTag(48); + output.WriteBool(IsTakeCard); + } + if (V != 0D) { + output.WriteRawTag(57); + output.WriteDouble(V); + } + if (A != 0D) { + output.WriteRawTag(65); + output.WriteDouble(A); + } + if (P != 0D) { + output.WriteRawTag(73); + output.WriteDouble(P); + } + if (EnergyConsumption_ != 0D) { + output.WriteRawTag(81); + output.WriteDouble(EnergyConsumption_); + } + if (SumEnergyConsumption != 0D) { + output.WriteRawTag(89); + output.WriteDouble(SumEnergyConsumption); + } + if (CreateTime != 0L) { + output.WriteRawTag(96); + output.WriteInt64(CreateTime); + } + if (RoomNumber.Length != 0) { + output.WriteRawTag(106); + output.WriteString(RoomNumber); + } + if (CarbonVIP != 0) { + output.WriteRawTag(112); + output.WriteInt32(CarbonVIP); + } + if (IdentityInfo != 0) { + output.WriteRawTag(120); + output.WriteInt32(IdentityInfo); + } + deviceStatusList_.WriteTo(output, _repeated_deviceStatusList_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HotelCode != 0L) { + output.WriteRawTag(8); + output.WriteInt64(HotelCode); + } + if (HostNumber.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HostNumber); + } + if (Mac.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Mac); + } + if (EndPoint.Length != 0) { + output.WriteRawTag(34); + output.WriteString(EndPoint); + } + if (Version.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Version); + } + if (IsTakeCard != false) { + output.WriteRawTag(48); + output.WriteBool(IsTakeCard); + } + if (V != 0D) { + output.WriteRawTag(57); + output.WriteDouble(V); + } + if (A != 0D) { + output.WriteRawTag(65); + output.WriteDouble(A); + } + if (P != 0D) { + output.WriteRawTag(73); + output.WriteDouble(P); + } + if (EnergyConsumption_ != 0D) { + output.WriteRawTag(81); + output.WriteDouble(EnergyConsumption_); + } + if (SumEnergyConsumption != 0D) { + output.WriteRawTag(89); + output.WriteDouble(SumEnergyConsumption); + } + if (CreateTime != 0L) { + output.WriteRawTag(96); + output.WriteInt64(CreateTime); + } + if (RoomNumber.Length != 0) { + output.WriteRawTag(106); + output.WriteString(RoomNumber); + } + if (CarbonVIP != 0) { + output.WriteRawTag(112); + output.WriteInt32(CarbonVIP); + } + if (IdentityInfo != 0) { + output.WriteRawTag(120); + output.WriteInt32(IdentityInfo); + } + deviceStatusList_.WriteTo(ref output, _repeated_deviceStatusList_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HotelCode != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(HotelCode); + } + if (HostNumber.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HostNumber); + } + if (Mac.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Mac); + } + if (EndPoint.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(EndPoint); + } + if (Version.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); + } + if (IsTakeCard != false) { + size += 1 + 1; + } + if (V != 0D) { + size += 1 + 8; + } + if (A != 0D) { + size += 1 + 8; + } + if (P != 0D) { + size += 1 + 8; + } + if (EnergyConsumption_ != 0D) { + size += 1 + 8; + } + if (SumEnergyConsumption != 0D) { + size += 1 + 8; + } + if (CreateTime != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(CreateTime); + } + if (RoomNumber.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RoomNumber); + } + if (CarbonVIP != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(CarbonVIP); + } + if (IdentityInfo != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(IdentityInfo); + } + size += deviceStatusList_.CalculateSize(_repeated_deviceStatusList_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(EnergyConsumption other) { + if (other == null) { + return; + } + if (other.HotelCode != 0L) { + HotelCode = other.HotelCode; + } + if (other.HostNumber.Length != 0) { + HostNumber = other.HostNumber; + } + if (other.Mac.Length != 0) { + Mac = other.Mac; + } + if (other.EndPoint.Length != 0) { + EndPoint = other.EndPoint; + } + if (other.Version.Length != 0) { + Version = other.Version; + } + if (other.IsTakeCard != false) { + IsTakeCard = other.IsTakeCard; + } + if (other.V != 0D) { + V = other.V; + } + if (other.A != 0D) { + A = other.A; + } + if (other.P != 0D) { + P = other.P; + } + if (other.EnergyConsumption_ != 0D) { + EnergyConsumption_ = other.EnergyConsumption_; + } + if (other.SumEnergyConsumption != 0D) { + SumEnergyConsumption = other.SumEnergyConsumption; + } + if (other.CreateTime != 0L) { + CreateTime = other.CreateTime; + } + if (other.RoomNumber.Length != 0) { + RoomNumber = other.RoomNumber; + } + if (other.CarbonVIP != 0) { + CarbonVIP = other.CarbonVIP; + } + if (other.IdentityInfo != 0) { + IdentityInfo = other.IdentityInfo; + } + deviceStatusList_.Add(other.deviceStatusList_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + HotelCode = input.ReadInt64(); + break; + } + case 18: { + HostNumber = input.ReadString(); + break; + } + case 26: { + Mac = input.ReadString(); + break; + } + case 34: { + EndPoint = input.ReadString(); + break; + } + case 42: { + Version = input.ReadString(); + break; + } + case 48: { + IsTakeCard = input.ReadBool(); + break; + } + case 57: { + V = input.ReadDouble(); + break; + } + case 65: { + A = input.ReadDouble(); + break; + } + case 73: { + P = input.ReadDouble(); + break; + } + case 81: { + EnergyConsumption_ = input.ReadDouble(); + break; + } + case 89: { + SumEnergyConsumption = input.ReadDouble(); + break; + } + case 96: { + CreateTime = input.ReadInt64(); + break; + } + case 106: { + RoomNumber = input.ReadString(); + break; + } + case 112: { + CarbonVIP = input.ReadInt32(); + break; + } + case 120: { + IdentityInfo = input.ReadInt32(); + break; + } + case 130: { + deviceStatusList_.AddEntriesFrom(input, _repeated_deviceStatusList_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + HotelCode = input.ReadInt64(); + break; + } + case 18: { + HostNumber = input.ReadString(); + break; + } + case 26: { + Mac = input.ReadString(); + break; + } + case 34: { + EndPoint = input.ReadString(); + break; + } + case 42: { + Version = input.ReadString(); + break; + } + case 48: { + IsTakeCard = input.ReadBool(); + break; + } + case 57: { + V = input.ReadDouble(); + break; + } + case 65: { + A = input.ReadDouble(); + break; + } + case 73: { + P = input.ReadDouble(); + break; + } + case 81: { + EnergyConsumption_ = input.ReadDouble(); + break; + } + case 89: { + SumEnergyConsumption = input.ReadDouble(); + break; + } + case 96: { + CreateTime = input.ReadInt64(); + break; + } + case 106: { + RoomNumber = input.ReadString(); + break; + } + case 112: { + CarbonVIP = input.ReadInt32(); + break; + } + case 120: { + IdentityInfo = input.ReadInt32(); + break; + } + case 130: { + deviceStatusList_.AddEntriesFrom(ref input, _repeated_deviceStatusList_codec); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/BLWLogProduce/EnergyConsumption.proto b/BLWLogProduce/EnergyConsumption.proto new file mode 100644 index 0000000..35b809b --- /dev/null +++ b/BLWLogProduce/EnergyConsumption.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package BLWData.Entity; + +// 定义一个Person消息类型 +message EnergyConsumption { + int64 HotelCode = 1; + string HostNumber = 2; + string Mac = 3; + string EndPoint = 4; + string Version = 5; + bool IsTakeCard = 6; + double V = 7; + double A = 8; + double P = 9; + double Energy_Consumption = 10; + double Sum_Energy_Consumption = 11; + int64 CreateTime=12; + string RoomNumber=13; + int32 CarbonVIP=14; +} \ No newline at end of file diff --git a/BLWLogProduce/Models/WaiBuJianKong.cs b/BLWLogProduce/Models/WaiBuJianKong.cs new file mode 100644 index 0000000..68404bb --- /dev/null +++ b/BLWLogProduce/Models/WaiBuJianKong.cs @@ -0,0 +1,61 @@ +using System.Runtime.CompilerServices; +using System.Text; + +namespace BLWLogProduce.Models +{ + public class WaiBuJianKong + { + public static string WaiBuJianKongSourceFileName = "Para_copy.yaml"; + public static string WaiBuJianKongTargetFileName = "C:\\Program Files\\windows_exporter\\textfile_inputs\\Para.prom"; + public static string Data = ""; + + static WaiBuJianKong() + { + string getdata = File.ReadAllText(WaiBuJianKongSourceFileName, Encoding.UTF8); + Data = getdata; + } + public static grafana_data data = new grafana_data(); + + public static string UDPPackage_TotalRecvPackage = "UDPPackage_TotalRecvPackage"; + public static string UDPPackage_TotalSendPackage = "UDPPackage_TotalSendPackage"; + public static string RCU_Online = "RCUOnLine"; + public static string TakeCardIn = "TakeCardIn"; + public static string UDPPackage_Heart = "UDPPackage_Heart"; + public static string UDPPackage_SearchHost = "UDPPackage_SearchHost"; + public static string UDPPackage_Intercept = "UDPPackage_Intercept"; + public static string 在线用户 = "在线用户"; + public static string UDPPackage_能耗 = "UDPPackage_能耗"; + public static string UDPPackage_StatusPass = "UDPPackage_StatusPass"; + + + public static string UDPPackage_TCL电视Discovery = "UDPPackage_TCL电视Discovery"; + public static string UDPPackage_TCL电视Control = "UDPPackage_TCL电视Control"; + + public static string UDPPackage_小度音箱Discovery = "UDPPackage_小度音箱Discovery"; + public static string UDPPackage_小度音箱Control = "UDPPackage_小度音箱Control"; + + public static string UDPPackage_TianMaoQueryAll = "UDPPackage_TianMaoQueryAll"; + public static string UDPPackage_TianMaoCONTROL = "UDPPackage_TianMaoCONTROL"; + } + public class grafana_data + { + public string? WireShark_UDPCapCount { get; set; } = "0"; + public string? UDP_Upload { get; set; } = "0"; + public string? UDP_Sent { get; set; } = "0"; + public string? RCU_Online { get; set; } = "0"; + public string? RCU_TakeCard { get; set; } = "0"; + public string? RCU_Heart { get; set; } = "0"; + public string? RCU_SearchHost { get; set; } = "0"; + public string? Intercept { get; set; } = "0"; + public string? WebUser { get; set; } = "0"; + public string? Energy { get; set; } = "0"; + public string? RCU_OE { get; set; } = "0"; + public string? TCL_Ctr_D { get; set; } = "0"; + public string? TCL_Ctr_C { get; set; } = "0"; + public string? TM_Ctr_D { get; set; } = "0"; + public string? TM_Ctr_C { get; set; } = "0"; + public string? XD_Ctr_D { get; set; } = "0"; + public string? XD_Ctr_C { get; set; } = "0"; + public string? Hivi_Ctr { get; set; } = "0"; + } +} diff --git a/BLWLogProduce/NLog.xsd b/BLWLogProduce/NLog.xsd new file mode 100644 index 0000000..43f470d --- /dev/null +++ b/BLWLogProduce/NLog.xsd @@ -0,0 +1,5069 @@ + + + + + + + + + + + + + + + + Watch config file for changes and reload automatically. + + + + + Print internal NLog messages to the console. Default value is: false + + + + + Print internal NLog messages to the console error output. Default value is: false + + + + + Write internal NLog messages to the specified file. + + + + + Log level threshold for internal log messages. Default value is: Info. + + + + + Global log level threshold for application log messages. Messages below this level won't be logged. + + + + + Throw an exception when there is an internal error. Default value is: false. Not recommend to set to true in production! + + + + + Throw an exception when there is a configuration error. If not set, determined by throwExceptions. + + + + + Gets or sets a value indicating whether Variables should be kept on configuration reload. Default value is: false. + + + + + Write internal NLog messages to the System.Diagnostics.Trace. Default value is: false. + + + + + Write timestamps for internal NLog messages. Default value is: true. + + + + + Use InvariantCulture as default culture instead of CurrentCulture. Default value is: false. + + + + + Perform message template parsing and formatting of LogEvent messages (true = Always, false = Never, empty = Auto Detect). Default value is: empty. + + + + + + + + + + + + + + Make all targets within this section asynchronous (creates additional threads but the calling thread isn't blocked by any target writes). + + + + + + + + + + + + + + + + + Prefix for targets/layout renderers/filters/conditions loaded from this assembly. + + + + + Load NLog extensions from the specified file (*.dll) + + + + + Load NLog extensions from the specified assembly. Assembly name should be fully qualified. + + + + + + + + + + Filter on the name of the logger. May include wildcard characters ('*' or '?'). + + + + + Comma separated list of levels that this rule matches. + + + + + Minimum level that this rule matches. + + + + + Maximum level that this rule matches. + + + + + Level that this rule matches. + + + + + Comma separated list of target names. + + + + + Ignore further rules if this one matches. + + + + + Enable this rule. Note: disabled rules aren't available from the API. + + + + + Rule identifier to allow rule lookup with Configuration.FindRuleByName and Configuration.RemoveRuleByName. + + + + + Loggers matching will be restricted to specified minimum level for following rules. + + + + + + + + + + + + + + + Default action if none of the filters match. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the file to be included. You could use * wildcard. The name is relative to the name of the current config file. + + + + + Ignore any errors in the include file. + + + + + + + + Variable value. Note, the 'value' attribute has precedence over this one. + + + + + Layout type variable value. Note, the 'value' attribute has precedence over this one. + + + + + + Variable name. + + + + + Variable value. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Maximum number of log events that the buffer can keep. + + + + + Number of log events to be buffered. + + + + + Indicates whether buffer should grow as needed. + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Action to be taken when the lazy writer thread request queue count exceeds the set limit. + + + + + Limit on the number of requests in the lazy writer thread request queue. + + + + + Number of log events that should be processed in a batch by the lazy writer thread. + + + + + Whether to use the locking queue, instead of a lock-free concurrent queue + + + + + Number of batches of P:NLog.Targets.Wrappers.AsyncTargetWrapper.BatchSize to write before yielding into P:NLog.Targets.Wrappers.AsyncTargetWrapper.TimeToSleepBetweenBatches + + + + + Time in milliseconds to sleep between batches. (1 or less means trigger on new activity) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Name of the file to write to. + + + + + Header. + + + + + Footer. + + + + + Whether to write the Header on initial creation of file appender, even if the file is not empty. Default value is false, which means only write header when initial file is empty (Ex. ensures valid CSV files) + + + + + Indicates whether the footer should be written only when the file is archived. + + + + + Maximum days of archive files that should be kept. Zero or negative means disabled. + + + + + Format-string to convert archive sequence-number by using string.Format + + + + + Maximum number of archive files that should be kept. Negative means disabled. + + + + + Legacy archive logic where file-archive-logic moves active file to path specified by P:NLog.Targets.FileTarget.ArchiveFileName, and then recreates the active file. Use P:NLog.Targets.FileTarget.ArchiveSuffixFormat to control suffix format, instead of now obsolete token {#} + + + + + Indicates whether to trigger archive operation based on time-period, by moving active-file to file-path specified by P:NLog.Targets.FileTarget.ArchiveFileName + + + + + Size in bytes above which log files will be automatically archived. Zero or negative means disabled. + + + + + Indicates whether any existing log-file should be archived on startup. + + + + + Indicates whether concurrent writes to the log file by multiple processes on the same host. + + + + + + Whether or not this target should just discard all data that its asked to write. Mostly used for when testing NLog Stack except final write + + + + + Indicates whether to write BOM (byte order mark) in created files. + + + + + Indicates whether to enable log file(s) to be deleted. + + + + + Indicates whether to delete old log file on startup. + + + + + Indicates whether to create directories if they do not exist. + + + + + File encoding. + + + + + Indicates whether to replace file contents on each write instead of appending log message at the end. + + + + + Line ending mode. + + + + + Maximum number of seconds that files are kept open. Zero or negative means disabled. + + + + + Log file buffer size in bytes. + + + + + Indicates whether to automatically flush the file buffers after each log message. + + + + + Indicates whether to keep log file open instead of opening and closing it on each logging event. + + + + + Maximum number of seconds before open files are flushed. Zero or negative means disabled. + + + + + Maximum number of files to be kept open. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Delay the flush until the LogEvent has been confirmed as written + + + + + Condition expression. Log events who meet this condition will cause a flush on the wrapped target. + + + + + Only flush when LogEvent matches condition. Ignore explicit-flush, config-reload-flush and shutdown-flush + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Number of log events to be buffered. + + + + + Action to take if the buffer overflows. + + + + + Timeout (in milliseconds) after which the contents of buffer will be flushed if there's no write in the specified period of time. Use -1 to disable timed flushes. + + + + + Indicates whether to use sliding timeout. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + Indicates whether to auto-check if the console is available. - Disables console writing if Environment.UserInteractive = false (Windows Service) - Disables console writing if Console Standard Input is not available (Non-Console-App) + + + + + Enables output using ANSI Color Codes + + + + + The encoding for writing messages to the T:System.Console. + + + + + Support NO_COLOR=1 environment variable. See also https://no-color.org/ + + + + + Indicates whether to send the log messages to the standard error instead of the standard output. + + + + + Indicates whether to auto-flush after M:System.Console.WriteLine + + + + + Indicates whether to auto-check if the console has been redirected to file - Disables coloring logic when System.Console.IsOutputRedirected = true + + + + + Indicates whether to use default row highlighting rules. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Background color. + + + + + Condition that must be met in order to set the specified foreground and background color. + + + + + Foreground color. + + + + + + + + + + + + + + + Background color. + + + + + Condition that must be met before scanning the row for highlight of words + + + + + Foreground color. + + + + + Indicates whether to ignore case when comparing texts. + + + + + Text to be matched. You must specify either text or regex. + + + + + Indicates whether to match whole words only. + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + Indicates whether to auto-flush after M:System.Console.WriteLine + + + + + Indicates whether to auto-check if the console is available - Disables console writing if Environment.UserInteractive = false (Windows Service) - Disables console writing if Console Standard Input is not available (Non-Console-App) + + + + + The encoding for writing messages to the T:System.Console. + + + + + Whether to force M:System.Console.WriteLine (slower) instead of the faster internal buffering. + + + + + Indicates whether to send the log messages to the standard error instead of the standard output. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Database user name. If the ConnectionString is not provided this value will be used to construct the "User ID=" part of the connection string. + + + + + Database password. If the ConnectionString is not provided this value will be used to construct the "Password=" part of the connection string. + + + + + Database name. If the ConnectionString is not provided this value will be used to construct the "Database=" part of the connection string. + + + + + Name of the connection string (as specified in <connectionStrings> configuration section. + + + + + Database host name. If the ConnectionString is not provided this value will be used to construct the "Server=" part of the connection string. + + + + + Indicates whether to keep the database connection open between the log events. + + + + + Name of the database provider. + + + + + Connection string. When provided, it overrides the values specified in DBHost, DBUserName, DBPassword, DBDatabase. + + + + + Connection string using for installation and uninstallation. If not provided, regular ConnectionString is being used. + + + + + Configures isolated transaction batch writing. If supported by the database, then it will improve insert performance. + + + + + Text of the SQL command to be run on each log level. + + + + + Type of the SQL command to be run on each log level. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Convert format of the property value + + + + + Culture used for parsing property string-value for type-conversion + + + + + Value to assign on the object-property + + + + + Name for the object-property + + + + + Type of the object-property + + + + + + + + + + + + + + Type of the command. + + + + + Connection string to run the command against. If not provided, connection string from the target is used. + + + + + Indicates whether to ignore failures. + + + + + Command text. + + + + + + + + + + + + + + + + + + + + + Database parameter name. + + + + + Layout used for rendering the database-parameter value. + + + + + Database parameter DbType. + + + + + Database parameter size. + + + + + Database parameter precision. + + + + + Database parameter scale. + + + + + Type of the parameter. + + + + + Fallback value when result value is not available + + + + + Convert format of the database parameter value. + + + + + Culture used for parsing parameter string-value for type-conversion + + + + + Whether empty value should translate into DbNull. Requires database column to allow NULL values. + + + + + Database parameter DbType (without reflection logic) + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + + Indicates whether to include call site (class and method name) in the T:NLog.LogEventInfo + + + + + Indicates whether to include source info (file name and line number) in the T:NLog.LogEventInfo + + + + + Option to include all properties from the log events + + + + + Indicates whether to include contents of the T:NLog.GlobalDiagnosticsContext dictionary + + + + + Whether to include the contents of the T:NLog.ScopeContext nested-state-stack. + + + + + Whether to include the contents of the T:NLog.ScopeContext properties-dictionary. + + + + + List of property names to exclude when P:NLog.Targets.TargetWithContext.IncludeEventProperties is true + + + + + Event Name for M:System.Diagnostics.DiagnosticSource.Write(System.String,System.Object) + + + + + Value for Event Payload Level-Property + + + + + Source Name for T:System.Diagnostics.DiagnosticSource + + + + + + + + + + + + + + + + Name of the property. + + + + + Layout used for rendering the property value. + + + + + Fallback value when result value is not available + + + + + Whether empty property value should be included in the output. + + + + + Type of the property. + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Layout that renders event Category. + + + + + Optional entry type. When not set, or when not convertible to T:System.Diagnostics.EventLogEntryType then determined by T:NLog.LogLevel + + + + + Layout that renders event ID. + + + + + Name of the Event Log to write to. This can be System, Application or any user-defined name. + + + + + Name of the machine on which Event Log service is running. + + + + + Maximum Event log size in kilobytes. + + + + + Message length limit to write to the Event Log. + + + + + Value to be used as the event Source. + + + + + Action to take if the message is larger than the P:NLog.Targets.EventLogTarget.MaxMessageLength option. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether to return to the first target after any successful write. + + + + + Whether to enable batching, but fallback will be handled individually + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Name of the file to write to. + + + + + Header. + + + + + Footer. + + + + + Size in bytes above which log files will be automatically archived. Zero or negative means disabled. + + + + + Indicates whether to trigger archive operation based on time-period, by moving active-file to file-path specified by P:NLog.Targets.FileTarget.ArchiveFileName + + + + + Legacy archive logic where file-archive-logic moves active file to path specified by P:NLog.Targets.FileTarget.ArchiveFileName, and then recreates the active file. Use P:NLog.Targets.FileTarget.ArchiveSuffixFormat to control suffix format, instead of now obsolete token {#} + + + + + Indicates whether any existing log-file should be archived on startup. + + + + + Format-string to convert archive sequence-number by using string.Format + + + + + Maximum days of archive files that should be kept. Zero or negative means disabled. + + + + + Maximum number of archive files that should be kept. Negative means disabled. + + + + + Indicates whether the footer should be written only when the file is archived. + + + + + Whether to write the Header on initial creation of file appender, even if the file is not empty. Default value is false, which means only write header when initial file is empty (Ex. ensures valid CSV files) + + + + + + File encoding. + + + + + Indicates whether to create directories if they do not exist. + + + + + Indicates whether to delete old log file on startup. + + + + + Indicates whether to enable log file(s) to be deleted. + + + + + Indicates whether to write BOM (byte order mark) in created files. + + + + + Whether or not this target should just discard all data that its asked to write. Mostly used for when testing NLog Stack except final write + + + + + Line ending mode. + + + + + Indicates whether to replace file contents on each write instead of appending log message at the end. + + + + + Maximum number of files to be kept open. + + + + + Indicates whether to automatically flush the file buffers after each log message. + + + + + Log file buffer size in bytes. + + + + + Maximum number of seconds that files are kept open. Zero or negative means disabled. + + + + + Maximum number of seconds before open files are flushed. Zero or negative means disabled. + + + + + Indicates whether to keep log file open instead of opening and closing it on each logging event. + + + + + + + + + + + + + + + + Name of the target. + + + + + Condition expression. Log events who meet this condition will be forwarded to the wrapped target. + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Indicates whether log text should be appended to the text of the control instead of overwriting it. + + + + + Name of control to which NLog will log write log text. + + + + + Name of the Form on which the control is located. + + + + + Whether new log entry are added to the start or the end of the control + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Password for the custom SSL certificate specified by P:NLog.Targets.NetworkTarget.SslCertificateFile + + + + + File path to custom SSL certificate for TCP Socket SSL connections + + + + + SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. + + + + + The number of seconds a TCP socket send-operation will block before timeout error. Default = 100 secs (0 = wait forever when network cable unplugged and tcp-buffer becomes full). + + + + + Action that should be taken if the message is larger than P:NLog.Targets.NetworkTarget.MaxMessageSize + + + + + Action that should be taken, when more connections than P:NLog.Targets.NetworkTarget.MaxConnections. + + + + + Action that should be taken, when more pending messages than P:NLog.Targets.NetworkTarget.MaxQueueSize. + + + + + Maximum simultaneous connections. Requires P:NLog.Targets.NetworkTarget.KeepConnection = false + + + + + Indicates whether to keep connection open whenever possible. + + + + + The number of seconds a connection will remain idle before the first keep-alive probe is sent + + + + + Size of the connection cache (number of connections which are kept alive). Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + Network destination address. + + + + + Maximum queue size for a single connection. Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + + Whether to disable the delayed ACK timer, and avoid delay of 200 ms. Default = true. + + + + + + + + + Type of compression for protocol payload. Useful for UDP where datagram max-size is 8192 bytes. + + + + + + + Skip compression when protocol payload is below limit to reduce overhead in cpu-usage and additional headers + + + + + + Maximum message size in bytes. On limit breach then P:NLog.Targets.NetworkTarget.OnOverflow action is activated. + + + + + Encoding to be used. + + + + + End of line value if a newline is appended at the end of log message P:NLog.Targets.NetworkTarget.NewLine. + + + + + Indicates whether to append newline at the end of log message. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Identifier to perform group-by + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Name of the file to write to. + + + + + Header. + + + + + Footer. + + + + + Whether to write the Header on initial creation of file appender, even if the file is not empty. Default value is false, which means only write header when initial file is empty (Ex. ensures valid CSV files) + + + + + Indicates whether the footer should be written only when the file is archived. + + + + + Maximum days of archive files that should be kept. Zero or negative means disabled. + + + + + Format-string to convert archive sequence-number by using string.Format + + + + + Maximum number of archive files that should be kept. Negative means disabled. + + + + + Legacy archive logic where file-archive-logic moves active file to path specified by P:NLog.Targets.FileTarget.ArchiveFileName, and then recreates the active file. Use P:NLog.Targets.FileTarget.ArchiveSuffixFormat to control suffix format, instead of now obsolete token {#} + + + + + Indicates whether to trigger archive operation based on time-period, by moving active-file to file-path specified by P:NLog.Targets.FileTarget.ArchiveFileName + + + + + Size in bytes above which log files will be automatically archived. Zero or negative means disabled. + + + + + Indicates whether any existing log-file should be archived on startup. + + + + + Whether to enable file-compression using T:System.IO.Compression.GZipStream + + + + + Whether to emphasize Fastest-speed or Optimal-compression + + + + + + Whether or not this target should just discard all data that its asked to write. Mostly used for when testing NLog Stack except final write + + + + + Indicates whether to write BOM (byte order mark) in created files. + + + + + Indicates whether to enable log file(s) to be deleted. + + + + + Indicates whether to delete old log file on startup. + + + + + Indicates whether to create directories if they do not exist. + + + + + File encoding. + + + + + Indicates whether to replace file contents on each write instead of appending log message at the end. + + + + + Line ending mode. + + + + + Maximum number of seconds that files are kept open. Zero or negative means disabled. + + + + + Log file buffer size in bytes. + + + + + Indicates whether to automatically flush the file buffers after each log message. + + + + + Indicates whether to keep log file open instead of opening and closing it on each logging event. + + + + + Maximum number of seconds before open files are flushed. Zero or negative means disabled. + + + + + Maximum number of files to be kept open. + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Windows domain name to change context to. + + + + + Required impersonation level. + + + + + Type of the logon provider. + + + + + Logon Type. + + + + + User account password. + + + + + Indicates whether to revert to the credentials of the process instead of impersonating another user. + + + + + Username to change context to. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Interval in which messages will be written up to the P:NLog.Targets.Wrappers.LimitingTargetWrapper.MessageLimit number of messages. + + + + + Maximum allowed number of messages written per P:NLog.Targets.Wrappers.LimitingTargetWrapper.Interval. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Separator for T:NLog.ScopeContext operation-states-stack. + + + + + Stack separator for log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Log4j:event logger-xml-attribute. Default: ${logger} + + + + + Whether to include the contents of the T:NLog.ScopeContext properties-dictionary. + + + + + Whether to include log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Indicates whether to include source info (file name and line number) in the information sent over the network. + + + + + Option to include all properties from the log events + + + + + Indicates whether to include call site (class and method name) in the information sent over the network. + + + + + Log4j:event message-xml-element. Default: ${message} + + + + + Log4j:event log4japp-xml-element. By default it's the friendly name of the current AppDomain. + + + + + Instance of T:NLog.Layouts.Log4JXmlEventLayout that is used to format log messages. + + + + + Whether to include log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Action that should be taken, when more pending messages than P:NLog.Targets.NetworkTarget.MaxQueueSize. + + + + + Password for the custom SSL certificate specified by P:NLog.Targets.NetworkTarget.SslCertificateFile + + + + + File path to custom SSL certificate for TCP Socket SSL connections + + + + + SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. + + + + + The number of seconds a TCP socket send-operation will block before timeout error. Default = 100 secs (0 = wait forever when network cable unplugged and tcp-buffer becomes full). + + + + + Action that should be taken if the message is larger than P:NLog.Targets.NetworkTarget.MaxMessageSize + + + + + The number of seconds a connection will remain idle before the first keep-alive probe is sent + + + + + Maximum queue size for a single connection. Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + Maximum simultaneous connections. Requires P:NLog.Targets.NetworkTarget.KeepConnection = false + + + + + Indicates whether to keep connection open whenever possible. + + + + + Size of the connection cache (number of connections which are kept alive). Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + Network destination address. + + + + + Action that should be taken, when more connections than P:NLog.Targets.NetworkTarget.MaxConnections. + + + + + Type of compression for protocol payload. Useful for UDP where datagram max-size is 8192 bytes. + + + + + Skip compression when protocol payload is below limit to reduce overhead in cpu-usage and additional headers + + + + + Whether to disable the delayed ACK timer, and avoid delay of 200 ms. Default = true. + + + + + Maximum message size in bytes. On limit breach then P:NLog.Targets.NetworkTarget.OnOverflow action is activated. + + + + + Encoding to be used. + + + + + End of line value if a newline is appended at the end of log message P:NLog.Targets.NetworkTarget.NewLine. + + + + + Indicates whether to append newline at the end of log message. + + + + + + + + + + + + + + Log4j:data property-name. + + + + + Layout used for rendering the log4j:data property-value. + + + + + Whether empty property-value should be included in the output. Default = false + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Endpoint address. + + + + + Name of the endpoint configuration in WCF configuration file. + + + + + Indicates whether to use a WCF service contract that is one way (fire and forget) or two way (request-reply) + + + + + Client ID. + + + + + Indicates whether to include per-event properties in the payload sent to the server. + + + + + Indicates whether to use binary message encoding. + + + + + + + + + + + + + + + Name of the parameter. + + + + + Layout used for rendering the method-parameter value. + + + + + Fallback value when result value is not available + + + + + Type of the parameter. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + Indicates whether NewLine characters in the body should be replaced with tags. + + + + + Priority used for sending mails. + + + + + Indicates whether to add new lines between log entries. + + + + + Encoding to be used for sending e-mail. + + + + + BCC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + Recipients' email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + Indicates whether to send message as HTML instead of plain text. + + + + + Sender's email address (e.g. joe@domain.com). + + + + + Mail message body (repeated for each log message send in one mail). + + + + + Mail subject. + + + + + CC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + + Provides a way of specifying the SSL and/or TLS encryption If P:NLog.MailKit.MailTarget.EnableSsl is true, then F:MailKit.Security.SecureSocketOptions.SslOnConnect will be used. + + + + + Get or set whether the client should use the REQUIRETLS extension if it is available. + + + + + Indicates the SMTP client timeout. + + + + + Folder where applications save mail messages to be processed by the local SMTP server. + + + + + SMTP Server to be used for sending. + + + + + Port number that SMTP Server is listening on. + + + + + Indicates whether SSL (secure sockets layer) should be used when communicating with SMTP server. + + + + + Password used to authenticate against SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + Username used to connect to SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + SMTP Authentication mode. + + + + + Indicates whether the default Settings from System.Net.MailSettings should be used. + + + + + Indicates whether SmtpClient should ignore invalid certificate. + + + + + Specifies how outgoing email messages will be handled. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + Max number of items to have in memory. Zero or Negative means no limit. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Message box title. + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Encoding to be used when writing text to the queue. + + + + + Indicates whether to use the XML format when serializing message. + + + + + Indicates whether to check if a queue exists before writing to it. + + + + + Indicates whether to create the queue if it doesn't exists. + + + + + Label to associate with each message. + + + + + Name of the queue to write to. + + + + + Indicates whether to use recoverable messages (with guaranteed delivery). + + + + + Indicates whether sending to a transactional queue using single-transaction-style. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Class name. + + + + + Method name. The method must be public and static. Use the AssemblyQualifiedName - https://learn.microsoft.com/dotnet/api/system.type.assemblyqualifiedname + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + + Indicates whether to include call site (class and method name) in the T:NLog.LogEventInfo + + + + + Indicates whether to include source info (file name and line number) in the T:NLog.LogEventInfo + + + + + Option to include all properties from the log events + + + + + Indicates whether to include contents of the T:NLog.GlobalDiagnosticsContext dictionary + + + + + Whether to include the contents of the T:NLog.ScopeContext nested-state-stack. + + + + + Whether to include the contents of the T:NLog.ScopeContext properties-dictionary. + + + + + List of property names to exclude when P:NLog.Targets.TargetWithContext.IncludeEventProperties is true + + + + + EventId forwarded to ILogger + + + + + EventId-Name forwarded to ILogger + + + + + Override name of ILogger, when target has been initialized with T:Microsoft.Extensions.Logging.ILoggerFactory + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Password for the custom SSL certificate specified by P:NLog.Targets.NetworkTarget.SslCertificateFile + + + + + File path to custom SSL certificate for TCP Socket SSL connections + + + + + SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. + + + + + The number of seconds a TCP socket send-operation will block before timeout error. Default = 100 secs (0 = wait forever when network cable unplugged and tcp-buffer becomes full). + + + + + Action that should be taken if the message is larger than P:NLog.Targets.NetworkTarget.MaxMessageSize + + + + + Action that should be taken, when more connections than P:NLog.Targets.NetworkTarget.MaxConnections. + + + + + Action that should be taken, when more pending messages than P:NLog.Targets.NetworkTarget.MaxQueueSize. + + + + + Maximum simultaneous connections. Requires P:NLog.Targets.NetworkTarget.KeepConnection = false + + + + + Indicates whether to keep connection open whenever possible. + + + + + The number of seconds a connection will remain idle before the first keep-alive probe is sent + + + + + Size of the connection cache (number of connections which are kept alive). Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + Network destination address. + + + + + Maximum queue size for a single connection. Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + Type of compression for protocol payload. Useful for UDP where datagram max-size is 8192 bytes. + + + + + Skip compression when protocol payload is below limit to reduce overhead in cpu-usage and additional headers + + + + + Whether to disable the delayed ACK timer, and avoid delay of 200 ms. Default = true. + + + + + Maximum message size in bytes. On limit breach then P:NLog.Targets.NetworkTarget.OnOverflow action is activated. + + + + + Encoding to be used. + + + + + End of line value if a newline is appended at the end of log message P:NLog.Targets.NetworkTarget.NewLine. + + + + + Indicates whether to append newline at the end of log message. + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Indicates whether to perform layout calculation. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether performance counter should be automatically created. + + + + + Name of the performance counter category. + + + + + Counter help text. + + + + + Name of the performance counter. + + + + + Performance counter type. + + + + + The value by which to increment the counter. + + + + + Performance counter instance name. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Default filter to be applied when no specific rule matches. + + + + + + + + + + + + + Condition to be tested. + + + + + Resulting filter to be applied when the condition matches. + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + + Name of the target. + + + + + Number of times to repeat each log message. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Whether to enable batching, and only apply single delay when a whole batch fails + + + + + Number of retries that should be attempted on the wrapped target in case of a failure. + + + + + Time to wait between retries in milliseconds. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Initial width of the form with rich text box. + + + + + Indicates whether the created window will be a tool window. + + + + + Indicates whether the created form will be initially minimized. + + + + + Maximum number of lines the rich text box will store (or 0 to disable this feature). + + + + + gets or sets the message retention strategy which determines how the target handles messages when there's no control attached, or when switching between controls + + + + + Name of the Form on which the control is located. If there is no open form of a specified name than NLog will create a new one. + + + + + Name of RichTextBox to which Nlog will write. + + + + + Indicates whether scroll bar will be moved automatically to show most recent log entries. + + + + + Indicates whether to create accessory form if the specified form/control combination was not found during target initialization. + + + + + Initial height of the form with rich text box. + + + + + Indicates whether to use default coloring rules. + + + + + Form created (true) or used an existing (false). Set after M:NLog.Windows.Forms.RichTextBoxTarget.InitializeTarget. Can be true only if P:NLog.Windows.Forms.RichTextBoxTarget.AllowAccessoryFormCreation is set to true (default). + + + + + If set to true, using "rtb-link" renderer (T:NLog.Windows.Forms.RichTextBoxLinkLayoutRenderer) would create clickable links in the control. E:NLog.Windows.Forms.RichTextBoxTarget.LinkClicked + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Background color. + + + + + Font color. + + + + + Font style of matched text. + + + + + Condition that must be met in order to set the specified font color. + + + + + + + + + + + + + + + + Background color. Names are identical with KnownColor enum extended with Empty value which means that background color won't be changed. + + + + + Font color. Names are identical with KnownColor enum extended with Empty value which means that font color won't be changed. + + + + + Font style of matched text. Possible values are the same as in FontStyle enum in System.Drawing. + + + + + Indicates whether to ignore case when comparing texts. + + + + + Regular expression to be matched. You must specify either text or regex. + + + + + Text to be matched. You must specify either text or regex. + + + + + Indicates whether to match whole words only. + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Password for the custom SSL certificate specified by P:NLog.Targets.NetworkTarget.SslCertificateFile + + + + + File path to custom SSL certificate for TCP Socket SSL connections + + + + + SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. + + + + + Action that should be taken, when more pending messages than P:NLog.Targets.NetworkTarget.MaxQueueSize. + + + + + Action that should be taken if the message is larger than P:NLog.Targets.NetworkTarget.MaxMessageSize + + + + + Action that should be taken, when more connections than P:NLog.Targets.NetworkTarget.MaxConnections. + + + + + The number of seconds a TCP socket send-operation will block before timeout error. Default = 100 secs (0 = wait forever when network cable unplugged and tcp-buffer becomes full). + + + + + Maximum simultaneous connections. Requires P:NLog.Targets.NetworkTarget.KeepConnection = false + + + + + Indicates whether to keep connection open whenever possible. + + + + + The number of seconds a connection will remain idle before the first keep-alive probe is sent + + + + + Size of the connection cache (number of connections which are kept alive). Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + Network destination address. + + + + + Maximum queue size for a single connection. Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + + + + + + + + + + + + + Whether to disable the delayed ACK timer, and avoid delay of 200 ms. Default = true. + + + + + + Skip compression when protocol payload is below limit to reduce overhead in cpu-usage and additional headers + + + + + Type of compression for protocol payload. Useful for UDP where datagram max-size is 8192 bytes. + + + + + Maximum message size in bytes. On limit breach then P:NLog.Targets.NetworkTarget.OnOverflow action is activated. + + + + + Encoding to be used. + + + + + End of line value if a newline is appended at the end of log message P:NLog.Targets.NetworkTarget.NewLine. + + + + + Indicates whether to append newline at the end of log message. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Name of the Form on which the ToolStrip is located. + + + + + Name of the ToolStripItem to which NLog will log write log text. + + + + + Name of ToolStrip that contains the ToolStripItem to which NLog will log write log text. + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + + Forward F:NLog.LogLevel.Fatal to M:System.Diagnostics.Trace.Fail(System.String) (Instead of M:System.Diagnostics.Trace.TraceError(System.String)) + + + + + Force use M:System.Diagnostics.Trace.WriteLine(System.String) independent of T:NLog.LogLevel + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Encoding. + + + + + Should we include the BOM (Byte-order-mark) for UTF? Influences the P:NLog.Targets.WebServiceTarget.Encoding property. This will only work for UTF-8. + + + + + Web service method name. Only used with Soap. + + + + + Web service namespace. Only used with Soap. + + + + + Protocol to be used when calling web service. + + + + + Custom proxy address, include port separated by a colon + + + + + Proxy configuration when calling web service + + + + + Web service URL. + + + + + Value of the User-agent HTTP header. + + + + + Indicates whether to pre-authenticate the HttpWebRequest (Requires 'Authorization' in P:NLog.Targets.WebServiceTarget.Headers parameters) + + + + + Name of the root XML element, if POST of XML document chosen. If so, this property must not be null. (see P:NLog.Targets.WebServiceTarget.Protocol and F:NLog.Targets.WebServiceProtocol.XmlPost). + + + + + (optional) root namespace of the XML document, if POST of XML document chosen. (see P:NLog.Targets.WebServiceTarget.Protocol and F:NLog.Targets.WebServiceProtocol.XmlPost). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Custom column delimiter value (valid when P:NLog.Layouts.CsvLayout.Delimiter is set to F:NLog.Layouts.CsvColumnDelimiterMode.Custom). + + + + + Column delimiter. + + + + + Footer layout. + + + + + Header layout. + + + + + Body layout (can be repeated multiple times). + + + + + Quote Character. + + + + + Quoting mode. + + + + + Indicates whether CSV should include header. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the column. + + + + + Layout used for rendering the column value. + + + + + Override of Quoting mode + + + + + + + + + + + + + + + + + + + + + + Option to exclude null/empty properties from the log event (as JSON) + + + + + List of property names to exclude when P:NLog.Layouts.GelfLayout.IncludeEventProperties is true + + + + + Whether to activate the legacy Graylog Message Facility-field + + + + + Graylog Message Full-Message-field + + + + + Graylog Message Host-field + + + + + Graylog Message Short-Message-field + + + + + Option to include all properties from the log events + + + + + List of property names to include when P:NLog.Layouts.GelfLayout.IncludeEventProperties is true + + + + + Whether to include the contents of the T:NLog.ScopeContext properties-dictionary. + + + + + + + + + + + + + + + + Option to render the empty object value {} + + + + + Option to suppress the extra spaces in the output json. + + + + + + + + + + + + + + + + + + + + + + + Option to include all properties from the log event (as JSON) + + + + + Indicates whether to include contents of the T:NLog.GlobalDiagnosticsContext dictionary. + + + + + Whether to include the contents of the T:NLog.ScopeContext dictionary. + + + + + Option to exclude null/empty properties from the log event (as JSON) + + + + + List of property names to exclude when P:NLog.Layouts.JsonLayout.IncludeAllProperties is true + + + + + Auto indent and create new lines + + + + + How far should the JSON serializer follow object references before backing off + + + + + Option to render the empty object value {} + + + + + Option to suppress the extra spaces in the output json. + + + + + + + + + + + + + + + + + + Name of the attribute. + + + + + Layout used for rendering the attribute value. + + + + + Fallback value when result value is not available + + + + + Whether output should be encoded as Json-String-Property, or be treated as valid json. + + + + + Indicates whether to escape non-ascii characters + + + + + Whether empty attribute value should be included in the output. + + + + + Result value type, for conversion of layout rendering output + + + + + + + + + + + + + + Footer layout. + + + + + Header layout. + + + + + Body layout (can be repeated multiple times). + + + + + + + + + + + + + + + + + + + + + + + + + + + Option to include all properties from the log events + + + + + Whether to include log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Whether to include log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Whether to include the contents of the T:NLog.ScopeContext properties-dictionary. + + + + + Stack separator for log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Stack separator for log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Whether the log4j:throwable xml-element should be written as CDATA + + + + + Log4j:event log4japp-xml-element. By default it's the friendly name of the current AppDomain. + + + + + Log4j:event message-xml-element. Default: ${message} + + + + + Indicates whether to include call site (class and method name) in the information sent over the network. + + + + + Indicates whether to include source info (file name and line number) in the information sent over the network. + + + + + Log4j:event logger-xml-attribute. Default: ${logger} + + + + + + + + + + + + + + + + + + + + + + + + + + Option to include all properties from the log event (as JSON) + + + + + Indicates whether to include contents of the T:NLog.GlobalDiagnosticsContext dictionary. + + + + + Whether to include the contents of the T:NLog.ScopeContext dictionary. + + + + + Option to exclude null/empty properties from the log event (as JSON) + + + + + List of property names to exclude when P:NLog.Layouts.JsonLayout.IncludeAllProperties is true + + + + + Auto indent and create new lines + + + + + How far should the JSON serializer follow object references before backing off + + + + + Option to render the empty object value {} + + + + + Option to suppress the extra spaces in the output json. + + + + + Whether to include "scopes"-section + + + + + Whether to include "Timestamp"-section + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Indicates whether LogEvent Properties should be included for StructuredData when P:NLog.Layouts.SyslogLayout.Rfc5424 = true + + + + + Indicates whether to use RFC 3164 for Syslog Format + + + + + Indicates whether to use RFC 5424 for Syslog Format + + + + + Prefix for StructuredData when P:NLog.Layouts.SyslogLayout.Rfc5424 = true + + + + + Name of the device / application / process sending the Syslog-message (Optional) + + + + + Device Facility + + + + + The FQDN or IPv4 address or IPv6 address or hostname of the sender machine (Optional) + + + + + Message Severity + + + + + Mesage Payload + + + + + The type of message that should be the same for events with the same semantics. Ex ${event-properties:EventId} (Optional) + + + + + Process Id or Process Name or Logger Name (Optional) + + + + + Indicates what DateTime format should be used when P:NLog.Layouts.SyslogLayout.Rfc5424 = true + + + + + + + + + + + + + + + + + + + Footer layout. + + + + + Header layout. + + + + + Body layout (can be repeated multiple times). + + + + + Newline to append after each directive header + + + + + + + + + + + + + Layout of the field. + + + + + Name of the field. + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the root XML element + + + + + Value inside the root XML element + + + + + Whether to include the contents of the T:NLog.ScopeContext dictionary. + + + + + List of property names to exclude when P:NLog.Layouts.XmlElementBase.IncludeEventProperties is true + + + + + Auto indent and create new lines + + + + + How far should the XML serializer follow object references before backing off + + + + + XML element name to use for rendering IList-collections items + + + + + XML attribute name to use when rendering property-key When null (or empty) then key-attribute is not included + + + + + XML element name to use when rendering properties + + + + + XML attribute name to use when rendering property-value When null (or empty) then value-attribute is not included and value is formatted as XML-element-value. + + + + + Determines whether or not this attribute will be Xml encoded. + + + + + Whether empty XML-element should be included in the output. + + + + + Option to include all properties from the log event (as XML) + + + + + + + + + + + + + + + + + Name of the attribute. + + + + + Layout used for rendering the attribute value. + + + + + Fallback value when result value is not available + + + + + Whether output should be encoded with Xml-string escaping, or be treated as valid xml-attribute-value + + + + + Whether empty attribute value should be included in the output. + + + + + Result value type, for conversion of layout rendering output + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the element + + + + + Whether to include the contents of the T:NLog.ScopeContext dictionary. + + + + + Layout used for rendering the XML-element InnerText. + + + + + Value inside the element + + + + + Whether output should be encoded with XML-string escaping, or be treated as valid xml-element-value + + + + + List of property names to exclude when P:NLog.Layouts.XmlElementBase.IncludeEventProperties is true + + + + + Auto indent and create new lines + + + + + How far should the XML serializer follow object references before backing off + + + + + XML element name to use for rendering IList-collections items + + + + + XML attribute name to use when rendering property-key When null (or empty) then key-attribute is not included + + + + + XML element name to use when rendering properties + + + + + XML attribute name to use when rendering property-value When null (or empty) then value-attribute is not included and value is formatted as XML-element-value. + + + + + Whether output should be wrapped using CDATA section instead of XML-string escaping + + + + + Whether empty XML-element should be included in the output. + + + + + Option to include all properties from the log event (as XML) + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Condition expression. + + + + + + + + + + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + Substring to be matched. + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + String to compare the layout to. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + Substring to be matched. + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + String to compare the layout to. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + + + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Append FilterCount to the P:NLog.LogEventInfo.Message when an event is no longer filtered + + + + + Insert FilterCount value into P:NLog.LogEventInfo.Properties when an event is no longer filtered + + + + + Applies the configured action to the initial logevent that starts the timeout period. Used to configure that it should ignore all events until timeout. + + + + + Layout to be used to filter log messages. + + + + + Max length of filter values, will truncate if above limit + + + + + How long before a filter expires, and logging is accepted again + + + + + Default number of unique filter values to expect, will automatically increase if needed + + + + + Max number of unique filter values to expect simultaneously + + + + + Default buffer size for the internal buffers + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BLWLogProduce/NewActionChangeDataPush.cs b/BLWLogProduce/NewActionChangeDataPush.cs new file mode 100644 index 0000000..299a6ca --- /dev/null +++ b/BLWLogProduce/NewActionChangeDataPush.cs @@ -0,0 +1,693 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: NewActionChangeDataPush.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace BLWData.Entity { + + /// Holder for reflection information generated from NewActionChangeDataPush.proto + public static partial class NewActionChangeDataPushReflection { + + #region Descriptor + /// File descriptor for NewActionChangeDataPush.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static NewActionChangeDataPushReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch1OZXdBY3Rpb25DaGFuZ2VEYXRhUHVzaC5wcm90bxIOQkxXRGF0YS5FbnRp", + "dHki/wEKF05ld0FjdGlvbkNoYW5nZURhdGFQdXNoEgwKBGNvZGUYASABKAMS", + "EgoKcm9vbU51bWJlchgCIAEoCRISCgpob3N0TnVtYmVyGAMgASgJEg8KB2Fk", + "ZHJlc3MYBCABKAkSDAoEbmFtZRgFIAEoCRIOCgZzdGF0dXMYBiABKAUSEgoK", + "YnJpZ2h0bmVzcxgHIAEoBRITCgtjdXJyZW50VGVtcBgIIAEoBRITCgtzZXR0", + "aW5nVGVtcBgJIAEoBRIQCghmYW5TcGVlZBgKIAEoBRIMCgRtb2RlGAsgASgF", + "Eg0KBXZhbHZlGAwgASgFEhIKCmNyZWF0ZXRpbWUYDSABKANiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::BLWData.Entity.NewActionChangeDataPush), global::BLWData.Entity.NewActionChangeDataPush.Parser, new[]{ "Code", "RoomNumber", "HostNumber", "Address", "Name", "Status", "Brightness", "CurrentTemp", "SettingTemp", "FanSpeed", "Mode", "Valve", "Createtime" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// 定义一个Person消息类型 + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class NewActionChangeDataPush : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NewActionChangeDataPush()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::BLWData.Entity.NewActionChangeDataPushReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public NewActionChangeDataPush() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public NewActionChangeDataPush(NewActionChangeDataPush other) : this() { + code_ = other.code_; + roomNumber_ = other.roomNumber_; + hostNumber_ = other.hostNumber_; + address_ = other.address_; + name_ = other.name_; + status_ = other.status_; + brightness_ = other.brightness_; + currentTemp_ = other.currentTemp_; + settingTemp_ = other.settingTemp_; + fanSpeed_ = other.fanSpeed_; + mode_ = other.mode_; + valve_ = other.valve_; + createtime_ = other.createtime_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public NewActionChangeDataPush Clone() { + return new NewActionChangeDataPush(this); + } + + /// Field number for the "code" field. + public const int CodeFieldNumber = 1; + private long code_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Code { + get { return code_; } + set { + code_ = value; + } + } + + /// Field number for the "roomNumber" field. + public const int RoomNumberFieldNumber = 2; + private string roomNumber_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string RoomNumber { + get { return roomNumber_; } + set { + roomNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "hostNumber" field. + public const int HostNumberFieldNumber = 3; + private string hostNumber_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HostNumber { + get { return hostNumber_; } + set { + hostNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "address" field. + public const int AddressFieldNumber = 4; + private string address_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Address { + get { return address_; } + set { + address_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 5; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "status" field. + public const int StatusFieldNumber = 6; + private int status_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Status { + get { return status_; } + set { + status_ = value; + } + } + + /// Field number for the "brightness" field. + public const int BrightnessFieldNumber = 7; + private int brightness_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Brightness { + get { return brightness_; } + set { + brightness_ = value; + } + } + + /// Field number for the "currentTemp" field. + public const int CurrentTempFieldNumber = 8; + private int currentTemp_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CurrentTemp { + get { return currentTemp_; } + set { + currentTemp_ = value; + } + } + + /// Field number for the "settingTemp" field. + public const int SettingTempFieldNumber = 9; + private int settingTemp_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int SettingTemp { + get { return settingTemp_; } + set { + settingTemp_ = value; + } + } + + /// Field number for the "fanSpeed" field. + public const int FanSpeedFieldNumber = 10; + private int fanSpeed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int FanSpeed { + get { return fanSpeed_; } + set { + fanSpeed_ = value; + } + } + + /// Field number for the "mode" field. + public const int ModeFieldNumber = 11; + private int mode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Mode { + get { return mode_; } + set { + mode_ = value; + } + } + + /// Field number for the "valve" field. + public const int ValveFieldNumber = 12; + private int valve_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Valve { + get { return valve_; } + set { + valve_ = value; + } + } + + /// Field number for the "createtime" field. + public const int CreatetimeFieldNumber = 13; + private long createtime_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Createtime { + get { return createtime_; } + set { + createtime_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as NewActionChangeDataPush); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(NewActionChangeDataPush other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Code != other.Code) return false; + if (RoomNumber != other.RoomNumber) return false; + if (HostNumber != other.HostNumber) return false; + if (Address != other.Address) return false; + if (Name != other.Name) return false; + if (Status != other.Status) return false; + if (Brightness != other.Brightness) return false; + if (CurrentTemp != other.CurrentTemp) return false; + if (SettingTemp != other.SettingTemp) return false; + if (FanSpeed != other.FanSpeed) return false; + if (Mode != other.Mode) return false; + if (Valve != other.Valve) return false; + if (Createtime != other.Createtime) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Code != 0L) hash ^= Code.GetHashCode(); + if (RoomNumber.Length != 0) hash ^= RoomNumber.GetHashCode(); + if (HostNumber.Length != 0) hash ^= HostNumber.GetHashCode(); + if (Address.Length != 0) hash ^= Address.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Status != 0) hash ^= Status.GetHashCode(); + if (Brightness != 0) hash ^= Brightness.GetHashCode(); + if (CurrentTemp != 0) hash ^= CurrentTemp.GetHashCode(); + if (SettingTemp != 0) hash ^= SettingTemp.GetHashCode(); + if (FanSpeed != 0) hash ^= FanSpeed.GetHashCode(); + if (Mode != 0) hash ^= Mode.GetHashCode(); + if (Valve != 0) hash ^= Valve.GetHashCode(); + if (Createtime != 0L) hash ^= Createtime.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Code != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Code); + } + if (RoomNumber.Length != 0) { + output.WriteRawTag(18); + output.WriteString(RoomNumber); + } + if (HostNumber.Length != 0) { + output.WriteRawTag(26); + output.WriteString(HostNumber); + } + if (Address.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Address); + } + if (Name.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Name); + } + if (Status != 0) { + output.WriteRawTag(48); + output.WriteInt32(Status); + } + if (Brightness != 0) { + output.WriteRawTag(56); + output.WriteInt32(Brightness); + } + if (CurrentTemp != 0) { + output.WriteRawTag(64); + output.WriteInt32(CurrentTemp); + } + if (SettingTemp != 0) { + output.WriteRawTag(72); + output.WriteInt32(SettingTemp); + } + if (FanSpeed != 0) { + output.WriteRawTag(80); + output.WriteInt32(FanSpeed); + } + if (Mode != 0) { + output.WriteRawTag(88); + output.WriteInt32(Mode); + } + if (Valve != 0) { + output.WriteRawTag(96); + output.WriteInt32(Valve); + } + if (Createtime != 0L) { + output.WriteRawTag(104); + output.WriteInt64(Createtime); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Code != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Code); + } + if (RoomNumber.Length != 0) { + output.WriteRawTag(18); + output.WriteString(RoomNumber); + } + if (HostNumber.Length != 0) { + output.WriteRawTag(26); + output.WriteString(HostNumber); + } + if (Address.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Address); + } + if (Name.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Name); + } + if (Status != 0) { + output.WriteRawTag(48); + output.WriteInt32(Status); + } + if (Brightness != 0) { + output.WriteRawTag(56); + output.WriteInt32(Brightness); + } + if (CurrentTemp != 0) { + output.WriteRawTag(64); + output.WriteInt32(CurrentTemp); + } + if (SettingTemp != 0) { + output.WriteRawTag(72); + output.WriteInt32(SettingTemp); + } + if (FanSpeed != 0) { + output.WriteRawTag(80); + output.WriteInt32(FanSpeed); + } + if (Mode != 0) { + output.WriteRawTag(88); + output.WriteInt32(Mode); + } + if (Valve != 0) { + output.WriteRawTag(96); + output.WriteInt32(Valve); + } + if (Createtime != 0L) { + output.WriteRawTag(104); + output.WriteInt64(Createtime); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Code != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Code); + } + if (RoomNumber.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RoomNumber); + } + if (HostNumber.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HostNumber); + } + if (Address.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Address); + } + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Status != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Status); + } + if (Brightness != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Brightness); + } + if (CurrentTemp != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(CurrentTemp); + } + if (SettingTemp != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(SettingTemp); + } + if (FanSpeed != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(FanSpeed); + } + if (Mode != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Mode); + } + if (Valve != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Valve); + } + if (Createtime != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Createtime); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(NewActionChangeDataPush other) { + if (other == null) { + return; + } + if (other.Code != 0L) { + Code = other.Code; + } + if (other.RoomNumber.Length != 0) { + RoomNumber = other.RoomNumber; + } + if (other.HostNumber.Length != 0) { + HostNumber = other.HostNumber; + } + if (other.Address.Length != 0) { + Address = other.Address; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Status != 0) { + Status = other.Status; + } + if (other.Brightness != 0) { + Brightness = other.Brightness; + } + if (other.CurrentTemp != 0) { + CurrentTemp = other.CurrentTemp; + } + if (other.SettingTemp != 0) { + SettingTemp = other.SettingTemp; + } + if (other.FanSpeed != 0) { + FanSpeed = other.FanSpeed; + } + if (other.Mode != 0) { + Mode = other.Mode; + } + if (other.Valve != 0) { + Valve = other.Valve; + } + if (other.Createtime != 0L) { + Createtime = other.Createtime; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Code = input.ReadInt64(); + break; + } + case 18: { + RoomNumber = input.ReadString(); + break; + } + case 26: { + HostNumber = input.ReadString(); + break; + } + case 34: { + Address = input.ReadString(); + break; + } + case 42: { + Name = input.ReadString(); + break; + } + case 48: { + Status = input.ReadInt32(); + break; + } + case 56: { + Brightness = input.ReadInt32(); + break; + } + case 64: { + CurrentTemp = input.ReadInt32(); + break; + } + case 72: { + SettingTemp = input.ReadInt32(); + break; + } + case 80: { + FanSpeed = input.ReadInt32(); + break; + } + case 88: { + Mode = input.ReadInt32(); + break; + } + case 96: { + Valve = input.ReadInt32(); + break; + } + case 104: { + Createtime = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Code = input.ReadInt64(); + break; + } + case 18: { + RoomNumber = input.ReadString(); + break; + } + case 26: { + HostNumber = input.ReadString(); + break; + } + case 34: { + Address = input.ReadString(); + break; + } + case 42: { + Name = input.ReadString(); + break; + } + case 48: { + Status = input.ReadInt32(); + break; + } + case 56: { + Brightness = input.ReadInt32(); + break; + } + case 64: { + CurrentTemp = input.ReadInt32(); + break; + } + case 72: { + SettingTemp = input.ReadInt32(); + break; + } + case 80: { + FanSpeed = input.ReadInt32(); + break; + } + case 88: { + Mode = input.ReadInt32(); + break; + } + case 96: { + Valve = input.ReadInt32(); + break; + } + case 104: { + Createtime = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/BLWLogProduce/Para_copy.yaml b/BLWLogProduce/Para_copy.yaml new file mode 100644 index 0000000..845e256 --- /dev/null +++ b/BLWLogProduce/Para_copy.yaml @@ -0,0 +1,60 @@ +# HELP UDP_Upload Total bytes uploaded via UDP. +# TYPE UDP_Upload gauge +UDP_Upload {1} + +# HELP UDP_Sent Total UDP packets sent. +# TYPE UDP_Sent gauge +UDP_Sent {2} + +# HELP RCU_Online Current number of online RCU units. +# TYPE RCU_Online gauge +RCU_Online {3} + +# HELP RCU_TakeCard Total number of card take operations performed by RCU units. +# TYPE RCU_TakeCard gauge +RCU_TakeCard {4} + +# HELP RCU_Heart Total number of heartbeats received from RCU units. +# TYPE RCU_Heart gauge +RCU_Heart {5} + +# HELP RCU_SearchHost Total number of host search operations performed by RCU units. +# TYPE RCU_SearchHost gauge +RCU_SearchHost {6} + +# HELP Intercept Number of intercept operations or intercepted items. +# TYPE Intercept gauge +Intercept {7} + +# HELP WebUser Number of active web users currently connected. +# TYPE WebUser gauge +WebUser {8} + +# HELP Energy Current energy consumption or energy level. +# TYPE Energy gauge +Energy {9} + +# HELP RCU_0E Number of RCU units with type 0E status. +# TYPE RCU_0E gauge +RCU_OE {10} + +# HELP TCL_Ctr Control counter or status for TCL devices. +# TYPE TCL_Ctr gauge +TCL_Ctr {11} + +# HELP TM_Ctr Control counter or status for TM devices. +# TYPE TM_Ctr gauge +TM_Ctr {12} + +# HELP XD_Ctr Control counter or status for XD devices. +# TYPE XD_Ctr gauge +XD_Ctr {13} + +# HELP Hivi_Ctr Control counter or status for Hivi devices. +# TYPE Hivi_Ctr gauge +Hivi_Ctr {14} + + +# HELP UDP_Cnt_Wireshark Total UDP packets captured and analyzed by Wireshark. +# TYPE UDP_Cnt_Wireshark gauge +UDP_Cnt_Wireshark {15} diff --git a/BLWLogProduce/Program.cs b/BLWLogProduce/Program.cs new file mode 100644 index 0000000..2f94812 --- /dev/null +++ b/BLWLogProduce/Program.cs @@ -0,0 +1,32 @@ +using BLWLogProduce.Services; + +namespace BLWLogProduce +{ + public class Program + { + public static void Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + + // Add services to the container. + + builder.Services.AddControllers(); + builder.Services.AddHostedService(); + builder.Services.AddHostedService(); + + builder.Services.AddMemoryCache(); + var app = builder.Build(); + + // Configure the HTTP request pipeline. + + app.UseHttpsRedirection(); + + app.UseAuthorization(); + + + app.MapControllers(); + + app.Run(); + } + } +} diff --git a/BLWLogProduce/Properties/launchSettings.json b/BLWLogProduce/Properties/launchSettings.json new file mode 100644 index 0000000..befbf22 --- /dev/null +++ b/BLWLogProduce/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:37373", + "sslPort": 44392 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "weatherforecast", + "applicationUrl": "http://localhost:5092", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "weatherforecast", + "applicationUrl": "https://localhost:7078;http://localhost:5092", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "weatherforecast", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/BLWLogProduce/Services/CPUDataCollect.cs b/BLWLogProduce/Services/CPUDataCollect.cs new file mode 100644 index 0000000..262d08e --- /dev/null +++ b/BLWLogProduce/Services/CPUDataCollect.cs @@ -0,0 +1,27 @@ + +using System.Collections.Concurrent; +using CommonTools; + +namespace BLWLogProduce.Services +{ + public class CPUDataCollect : BackgroundService + { + public static ConcurrentBag CPU_Data = new ConcurrentBag(); + protected override Task ExecuteAsync(CancellationToken stoppingToken) + { + return Task.Factory.StartNew(async () => + { + var timer = new PeriodicTimer(TimeSpan.FromSeconds(1)); + while (await timer.WaitForNextTickAsync(stoppingToken)) + { + Console.WriteLine("HostServiceTest_A is doing work."); + double d = CPUData.GetCPU(); + CPUDataCollect.CPU_Data.Add(d); + } + + Console.WriteLine("HostServiceTest_A task done."); + + }, TaskCreationOptions.LongRunning); + } + } +} diff --git a/BLWLogProduce/Services/CRICS_P_C.cs b/BLWLogProduce/Services/CRICS_P_C.cs new file mode 100644 index 0000000..285fd70 --- /dev/null +++ b/BLWLogProduce/Services/CRICS_P_C.cs @@ -0,0 +1,53 @@ + +using System.Threading.Channels; +using Common; +using static CSRedis.CSRedisClient; + +namespace BLWLogProduce.Services +{ + public class CRICS_P_C : BackgroundService + { + private static Channel _messageChannel; + + public CRICS_P_C() + { + + } + public static async Task ConsumeMessagesAsync() + { + while (true) + { + if (_messageChannel.Reader.TryRead(out var nnn)) + { + //CSRedisCacheHelper.redis3.Subscribe(wireshark); + } + } + } + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + try + { + // 创建无界Channel + _messageChannel = Channel.CreateUnbounded(); + await ConsumeMessagesAsync(); + var wireshark = ("crics-udp-package", new Action(async (args) => + { + try + { + await _messageChannel.Writer.WriteAsync(""); + } + catch (Exception) + { + + } + })); + + CSRedisCacheHelper.redis3.Subscribe(wireshark); + } + catch (Exception) + { + + } + } + } +} diff --git a/BLWLogProduce/Services/KafkaProduce.cs b/BLWLogProduce/Services/KafkaProduce.cs new file mode 100644 index 0000000..f63cfc6 --- /dev/null +++ b/BLWLogProduce/Services/KafkaProduce.cs @@ -0,0 +1,729 @@ + +using System.Diagnostics.Metrics; +using System.Text; +using System.Text.Json; +using System.Threading.Channels; +using BLWData.Entity; +using BLWLogProduce.Models; +using Common; +using CommonEntity; +using CommonTools; +using Confluent.Kafka; +using Google.Protobuf; +using MessagePack; +using Microsoft.Extensions.Caching.Memory; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using NLog; +using RestSharp; +using static CSRedis.CSRedisClient; + +namespace BLWLogProduce.Services +{ + public class KafkaProduce : BackgroundService + { + public IConfiguration Configuration { get; set; } + public IMemoryCache _Cache { get; set; } + + public KafkaProduce(IConfiguration configuration, IMemoryCache cache) + { + this.Configuration = configuration; + _Cache = cache; + } + + + public static Logger logger = LogManager.GetCurrentClassLogger(); + + + // 消费者方法 + + protected async override Task ExecuteAsync(CancellationToken stoppingToken) + { + + await Task.Factory.StartNew((state) => + { + try + { + string? ipport = Configuration["Kafka:EndPoint"]; + string? user = Configuration["Kafka:UserName"]; + string? pwd = Configuration["Kafka:PassWord"]; + var config = new ProducerConfig + { + BootstrapServers = ipport, + SecurityProtocol = SecurityProtocol.SaslPlaintext, + SaslMechanism = SaslMechanism.Plain, + SaslUsername = user, + SaslPassword = pwd + }; + var p = new ProducerBuilder(config).Build(); + //var p = new ProducerBuilder(config).Build(); + + ///udp 采集数据 + var wireshark = ("wireshark-cap-udp-totalcount", new Action(async (args) => + { + try + { + WaiBuJianKong.data.WireShark_UDPCapCount = args.Body; + } + catch (Exception) + { + + } + })); + ///udp 采集数据 + var DingYue = ("redis-udppackage", new Action(async (args) => + { + try + { + + string body = args.Body; + //Console.WriteLine("UDPData:"+body); + UDPPackage? usa = System.Text.Json.JsonSerializer.Deserialize(body); + if (usa != null) + { + string countsa = usa.TotalCount.ToString(); + if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_TotalRecvPackage)) + { + WaiBuJianKong.data.UDP_Upload = countsa; + } + else if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_TotalSendPackage)) + { + WaiBuJianKong.data.UDP_Sent = countsa; + } + else if (usa.CommandType.Equals(WaiBuJianKong.RCU_Online)) + { + WaiBuJianKong.data.RCU_Online = countsa; + } + else if (usa.CommandType.Equals(WaiBuJianKong.TakeCardIn)) + { + WaiBuJianKong.data.RCU_TakeCard = countsa; + } + + else if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_Heart)) + { + WaiBuJianKong.data.RCU_Heart = countsa; + } + else if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_SearchHost)) + { + WaiBuJianKong.data.RCU_SearchHost = countsa; + } + else if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_Intercept)) + { + WaiBuJianKong.data.Intercept = countsa; + } + else if (usa.CommandType.Equals(WaiBuJianKong.在线用户)) + { + WaiBuJianKong.data.WebUser = countsa; + } + else if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_能耗)) + { + WaiBuJianKong.data.Energy = countsa; + } + else if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_StatusPass)) + { + WaiBuJianKong.data.RCU_OE = countsa; + } + + else if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_TCL电视Discovery)) + { + WaiBuJianKong.data.TCL_Ctr_D = countsa; + } + else if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_TCL电视Control)) + { + WaiBuJianKong.data.TCL_Ctr_C = countsa; + } + + + else if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_小度音箱Discovery)) + { + WaiBuJianKong.data.XD_Ctr_D = countsa; + } + else if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_小度音箱Control)) + { + WaiBuJianKong.data.XD_Ctr_C = countsa; + } + + + else if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_TianMaoQueryAll)) + { + WaiBuJianKong.data.TM_Ctr_D = countsa; + } + else if (usa.CommandType.Equals(WaiBuJianKong.UDPPackage_TianMaoCONTROL)) + { + WaiBuJianKong.data.TM_Ctr_C = countsa; + } + + + } + var QQQ = usa.ExtraData; + if (QQQ != null && QQQ.Count > 0) + { + foreach (var item in QQQ) + { + string Location = ""; + if (_Cache.TryGetValue(item.Key, out Location)) + { + + } + else + { + Location = GetBaiduIp(item.Key); + _Cache.Set(item.Key, Location, DateTimeOffset.Now.AddHours(1)); + } + QQQ[item.Key] = Location; + } + } + byte[] bytes = MyMessagePacker.FastSerialize(usa); + + //byte[] bytes = MessagePackSerializer.Serialize(usa); + + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.UDPPackageKey; + + + + //var partition = new Partition(0); // 指定分区号 + //var topicPartition = new TopicPartition(TopicKey, partition); + //Console.WriteLine("产生了数据:"+body); + //var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = Encoding.UTF8.GetBytes(body) }); + var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + } + catch (Exception ex) + { + Console.WriteLine("redis-udppackage"); + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + var DingYue1 = ("redis-roomstatus-monitor", new Action(async (args) => + { + string body = args.Body; + + StepInfo? usa = System.Text.Json.JsonSerializer.Deserialize(body); + byte[] bytes = MyMessagePacker.FastSerialize(usa); + + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.UDPPackageStepMonitor; + + + + //var partition = new Partition(0); // 指定分区号 + //var topicPartition = new TopicPartition(TopicKey, partition); + await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + + + //await _messageChannel.Writer.WriteAsync(""); + })); + + //旁路系统 + var DingYue2 = ("redis-forksystemdata", new Action(async (args) => + { + string body = args.Body; + + ForkSystem? forkSystem = System.Text.Json.JsonSerializer.Deserialize(body); + byte[] qf = MyMessagePacker.FastSerialize(forkSystem); + + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.UDPPackageForkSystemKey; + + + //var partition = new Partition(0); // 指定分区号 + //var topicPartition = new TopicPartition(TopicKey, partition); + await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = qf }); + + + //await Task.Factory.StartNew(async () => + // { + // await ConsumeMessagesAsync(); + // }, TaskCreationOptions.LongRunning); + })); + + ///能耗 + var DingYue3 = ("redis-power", new Action(async (args) => + { + string body = args.Body; + + try + { + NengHao? poo = System.Text.Json.JsonSerializer.Deserialize(body); + //string str= Newtonsoft.Json.JsonConvert.SerializeObject(poo); + //Console.WriteLine("收到了"+str); + byte[] qf = MyMessagePacker.FastSerialize(poo); + + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.UDPPackagePowerMonitor; + await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = qf }); + + + List la = new List(); + foreach (var item in poo.AllDeviceData) + { + DeviceData dd = new DeviceData(); + dd.HostID = item.HostID; + dd.DeviceType = item.DeviceType; + dd.Address = item.Address; + dd.Brightness = item.Brightness; + dd.Status = item.Status; + dd.CurrentTemp = item.CurrentTemp; + dd.SettingTemp = item.SettingTemp; + dd.Mode = item.Mode; + dd.FanSpeed = item.FanSpeed; + dd.Valve = item.Valve; + la.Add(dd); + } + + //宝镜系统使用 + EnergyConsumption ese = new EnergyConsumption(); + ese.HotelCode = poo.HotelCode; + ese.HostNumber = poo.HostNumber; + ese.Mac = poo.Mac; + ese.EndPoint = poo.EndPoint; + ese.V = poo.V; + ese.A = poo.A; + ese.P = poo.P; + ese.EnergyConsumption_ = poo.Energy_Consumption; + ese.SumEnergyConsumption = poo.Sum_Energy_Consumption; + ese.CreateTime = poo.CreateTime; + ese.RoomNumber = poo.RoomNumber ?? ""; + ese.IsTakeCard = poo.IsTakeCard; + ese.CarbonVIP = poo.CarbonVIP; + ese.DeviceStatusList.AddRange(la); + ese.IdentityInfo = poo.IdentityInfo; + + + byte[] data = ese.ToByteArray(); + string TopicKey1 = KafkaKey.BLWLog4BaoJing_RCU_Topic; + string DetailKey1 = KafkaKey.UDPPackagePowerMonitor; + + await p.ProduceAsync(TopicKey1, new Message { Key = DetailKey1, Value = data }); + + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + var DingYue3_1 = ("redis-action-data", new Action(async (args) => + { + string body = args.Body; + + try + { + NewRoomtusPush? poo = System.Text.Json.JsonSerializer.Deserialize(body); + //byte[] qf = MyMessagePacker.FastSerialize(poo); + //string TopicKey = KafkaKey.BLWLog_RCU_Topic; + //string DetailKey = KafkaKey.UDPPackagePowerMonitor; + //await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = qf }); + + + //宝镜系统使用 + NewActionChangeDataPush ese = new NewActionChangeDataPush(); + ese.Code = poo.code; + ese.RoomNumber = poo.roomNumber; + ese.HostNumber = poo.hostnumber; + ese.Address = poo.address; + ese.Brightness = poo.brightness; + ese.Status = poo.status; + ese.Name = poo.name; + ese.CurrentTemp = poo.currentTemp; + ese.SettingTemp = poo.settingTemp; + ese.FanSpeed = poo.fanSpeed; + ese.Mode = poo.mode; + ese.Valve = poo.valve; + ese.Createtime = poo.createtime; + + + byte[] data = ese.ToByteArray(); + string TopicKey1 = KafkaKey.BLWLog4BaoJing_RCU_Topic; + string DetailKey1 = KafkaKey.UDPPackage_ActionData; + + await p.ProduceAsync(TopicKey1, new Message { Key = DetailKey1, Value = data }); + + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + + #region 碳达人 + //var DingYue3_1 = ("redis-carbon_trigger", new Action(async (args) => + //{ + // string body = args.Body; + + // NengHao? poo = System.Text.Json.JsonSerializer.Deserialize(body); + // //poo.ReportTime = DateTime.Now; + // byte[] qf = MyMessagePacker.FastSerialize(poo); + + // string TopicKey = KafkaKey.BLWLog_RCU_Topic; + // string DetailKey = KafkaKey.UDPPackagePowerMonitor; + // await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = qf }); + + + // //宝镜系统使用 + // EnergyConsumption ese = new EnergyConsumption(); + // ese.HotelCode = poo.HotelCode; + // ese.HostNumber = poo.HostNumber; + // ese.Mac = poo.Mac; + // ese.EndPoint = poo.EndPoint; + // ese.V = poo.V; + // ese.A = poo.A; + // ese.P = poo.P; + // ese.KWH = poo.KW_H; + // ese.SumKWH = poo.Sum_KW_H; + // ese.CreateTime = poo.CreateTime; + // ese.RoomNumber = poo.RoomNumber; + // ese.IsTakeCard = poo.IsTakeCard; + // ese.CarbonVIP = poo.CarbonVIP; + + // byte[] data = ese.ToByteArray(); + // string TopicKey1 = KafkaKey.BLWLog4BaoJing_RCU_Topic; + // string DetailKey1 = KafkaKey.UDPPackageWholeDataMonitor; + + // await p.ProduceAsync(TopicKey1, new Message { Key = DetailKey1, Value = data }); + + //})); + #endregion + + + //给宝镜推送数据 ,本意是推送原始的二进制,没有解析过的数据 + var DingYue10 = ("redis-baojing-powerdata", new Action(async (args) => + { + string body = args.Body; + try + { + + if (!string.IsNullOrEmpty(body)) + { + byte[] hexdata = Tools.GetBytesFromString(body); + + string TopicKey = KafkaKey.BLWLog4BaoJing_RCU_Topic; + string DetailKey = KafkaKey.InvokceThirdHttpInterface; + var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = hexdata }); + } + } + catch (Exception ex) + { + Console.WriteLine("宝镜错误数为:" + body); + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + + //小度 + var DingYue5 = ("redis-iotpackage", new Action(async (args) => + { + try + { + + string body = args.Body; + IOTMonitorData? usa = System.Text.Json.JsonSerializer.Deserialize(body); + //usa.CreateTime = DateTime.Now; + byte[] bytes = MyMessagePacker.FastSerialize(usa); + + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.IotMonitor; + + //var partition = new Partition(0); // 指定分区号 + //var topicPartition = new TopicPartition(TopicKey, partition); + var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + //在线离线状态 + var DingYue6 = ("redis-on_off_line", new Action(async (args) => + { + try + { + + string body = args.Body; + OnOffLineData? usa = System.Text.Json.JsonSerializer.Deserialize(body); + byte[] bytes = MyMessagePacker.FastSerialize(usa); + + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.RCUOnLineStatus; + + //var partition = new Partition(0); // 指定分区号 + //var topicPartition = new TopicPartition(TopicKey, partition); + var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + } + catch (Exception ex) + { + Console.WriteLine("aaaaaaaaaaaaaaaaaaaaaa"); + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + //取电状态 + var DingYue7 = ("redis-takecard_change", new Action(async (args) => + { + try + { + + string body = args.Body; + MTakeCardData? usa = System.Text.Json.JsonSerializer.Deserialize(body); + byte[] bytes = MyMessagePacker.FastSerialize(usa); + + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.TakeCardStatus; + + //var partition = new Partition(1); // 指定分区号 + //var topicPartition = new TopicPartition(TopicKey, partition); + var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + + + //服务状态变化 + var DingYue8 = ("redis-serviceinfo_change", new Action(async (args) => + { + try + { + + string body = args.Body; + OtherServiceInfo? usa = System.Text.Json.JsonSerializer.Deserialize(body); + byte[] bytes = MyMessagePacker.FastSerialize(usa); + + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.ServiceInfoStatus; + + //var partition = new Partition(1); // 指定分区号 + //var topicPartition = new TopicPartition(TopicKey, partition); + var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + + //第三方接口调用日志 + var DingYue9 = ("redis-invoke_httpinterface", new Action(async (args) => + { + try + { + + string body = args.Body; + Interface3Log? usa = System.Text.Json.JsonSerializer.Deserialize(body); + byte[] bytes = MyMessagePacker.FastSerialize(usa); + + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.InvokceThirdHttpInterface; + + + //var partition = new Partition(1); // 指定分区号 + //var topicPartition = new TopicPartition(TopicKey, partition); + var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + #region 新版本协议 + //新版主机数据重启原因 + var DingYue11 = ("redis-rcu-restart", new Action(async (args) => + { + try + { + string body = args.Body; + NewVersionHexData? usa = System.Text.Json.JsonSerializer.Deserialize(body); + byte[] bytes = MyMessagePacker.FastSerialize(usa); + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.RCUNewVersion_RestartReason; + var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + //取电状态 + var DingYue12 = ("redis-rcu-card_action", new Action(async (args) => + { + try + { + string body = args.Body; + NewVersionHexData? usa = System.Text.Json.JsonSerializer.Deserialize(body); + byte[] bytes = MyMessagePacker.FastSerialize(usa); + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.RCUNewVersion_TakeCard; + var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + //设备动作状态 + var DingYue13 = ("redis-rcu-hexdata", new Action(async (args) => + { + try + { + string body = args.Body; + NewVersionHexData? usa = System.Text.Json.JsonSerializer.Deserialize(body); + byte[] bytes = MyMessagePacker.FastSerialize(usa); + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.RCUNewVersion_0E; + var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + //注册 + var DingYue14 = ("redis-rcu-registerdata", new Action(async (args) => + { + try + { + string body = args.Body; + NewVersionHexData? usa = System.Text.Json.JsonSerializer.Deserialize(body); + byte[] bytes = MyMessagePacker.FastSerialize(usa); + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.RCUNewVersion_Register; + var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + //定时上报 + var DingYue15 = ("redis-rcu-timer_data", new Action(async (args) => + { + try + { + string body = args.Body; + NewVersionHexData? usa = System.Text.Json.JsonSerializer.Deserialize(body); + byte[] bytes = MyMessagePacker.FastSerialize(usa); + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.RCUNewTimerData; + var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + #endregion + + + CSRedisCacheHelper.redis3.Subscribe(wireshark); + + //这两个是统计 + CSRedisCacheHelper.redis3.Subscribe(DingYue); + CSRedisCacheHelper.redis3.Subscribe(DingYue1); + + //旁路 + //CSRedisCacheHelper.redis3.Subscribe(DingYue2); + CSRedisCacheHelper.redis3.Subscribe(DingYue3); + CSRedisCacheHelper.redis3.Subscribe(DingYue5); + CSRedisCacheHelper.redis3.Subscribe(DingYue6); + CSRedisCacheHelper.redis3.Subscribe(DingYue7); + CSRedisCacheHelper.redis3.Subscribe(DingYue8); + //CSRedisCacheHelper.redis3.Subscribe(DingYue9); + // 很抱歉打扰你了 + //CSRedisCacheHelper.redis3.Subscribe(DingYue10); + // 创建无界Channel + //_messageChannel = Channel.CreateUnbounded(); + //CSRedisCacheHelper.redis3.Subscribe(DingYue11); + //CSRedisCacheHelper.redis3.Subscribe(DingYue12); + //CSRedisCacheHelper.redis3.Subscribe(DingYue13); + //CSRedisCacheHelper.redis3.Subscribe(DingYue14); + //CSRedisCacheHelper.redis3.Subscribe(DingYue15); + + //CSRedisCacheHelper.redis3.Subscribe(DingYue3_1); + } + catch (Exception ex) + { + logger.Error(ex.Message); + logger.Error(ex.StackTrace); + } + }, TaskCreationOptions.LongRunning, stoppingToken); + } + + + /// + /// 百度api + /// + /// + public static string GetBaiduIp(string ip) + { + string location = ""; + try + { + string url = $"https://sp0.baidu.com"; + //WebClient client = new WebClient(); + RestSharp.RestClient client1 = new RestSharp.RestClient(url); + RestSharp.RestRequest request = new RestSharp.RestRequest($"/8aQDcjqpAAV3otqbppnN2DJv/api.php?query={ip}&co=&resource_id=6006&oe=utf8", Method.Get); + var buffer = client1.DownloadData(request); + //var buffer = client.DownloadData(url); + string jsonText = Encoding.UTF8.GetString(buffer); + JObject jo = JObject.Parse(jsonText); + + Root root = JsonConvert.DeserializeObject(jo.ToString()); + foreach (var item in root.data) + { + location = item.location; + } + return location; + } + catch (Exception ex) + { + //Console.WriteLine(ex); + return location; + } + + } + private static string NewMethod(string Key, string ti, double data) + { + UDPPackage v = new UDPPackage(); + v.CommandType = Key; + long CPU_MAX = (long)Math.Round(data); + v.TotalCount = CPU_MAX; + v.RemoveTime = ti; + string f1 = System.Text.Json.JsonSerializer.Serialize(v); + return f1; + } + + public static async Task ConsumeMessagesAsync() + { + while (true) + { + //if (_messageChannel.Reader.TryRead(out var nnn)) + //{ } + } + } + } +} diff --git a/BLWLogProduce/Services/MyTimer.cs b/BLWLogProduce/Services/MyTimer.cs new file mode 100644 index 0000000..7d5a45e --- /dev/null +++ b/BLWLogProduce/Services/MyTimer.cs @@ -0,0 +1,92 @@ + +using System.Text; +using System.Threading.Tasks; +using BLWLogProduce.Models; +using NLog; + +namespace BLWLogProduce.Services +{ + public class MyTimer : BackgroundService + { + public System.Timers.Timer jiankong_timer = null; + public MyTimer() + { + + } + protected override Task ExecuteAsync(CancellationToken stoppingToken) + { + jiankong_timer = new System.Timers.Timer(); + jiankong_timer.Interval = 60000; + jiankong_timer.Elapsed += Jiankong_timer_Elapsed; + jiankong_timer.Start(); + return Task.CompletedTask; + } + public static Logger logger = LogManager.GetCurrentClassLogger(); + private void Jiankong_timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e) + { + try + { + var df = WaiBuJianKong.data; + + string NewStringData = WaiBuJianKong.Data; + NewStringData = NewStringData.Replace("{1}", df.UDP_Upload) + .Replace("{2}", df.UDP_Sent) + .Replace("{3}", df.RCU_Online) + .Replace("{4}", df.RCU_TakeCard) + .Replace("{5}", df.RCU_Heart) + .Replace("{6}", df.RCU_SearchHost) + .Replace("{7}", df.Intercept) + .Replace("{8}", df.WebUser) + .Replace("{9}", df.Energy) + .Replace("{10}", df.RCU_OE) + .Replace("{15}",df.WireShark_UDPCapCount); + + int a = 0; + int b = 0; + int.TryParse(df.TCL_Ctr_D, out a); + int.TryParse(df.TCL_Ctr_C, out b); + NewStringData = NewStringData.Replace("{11}", (a + b).ToString()); + + + int c = 0; + int d = 0; + int.TryParse(df.TM_Ctr_D, out c); + int.TryParse(df.TM_Ctr_C, out d); + NewStringData = NewStringData.Replace("{12}", (c + d).ToString()); + + + int ee = 0; + int ff = 0; + int.TryParse(df.XD_Ctr_D, out ee); + int.TryParse(df.XD_Ctr_C, out ff); + NewStringData = NewStringData.Replace("{13}", (ee + ff).ToString()).Replace("{14}", "0"); + + + WanBuJianKong(NewStringData, "1.txt"); + File.WriteAllText("2.txt", NewStringData, Encoding.UTF8); + Console.WriteLine("here"); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + logger.Error(ex.Message); + logger.Error(ex.StackTrace); + } + } + + + public static void WanBuJianKong(string Data, string SourceTxt) + { + System.IO.File.WriteAllText(SourceTxt, Data, Encoding.UTF8); + // 如果目标文件存在,先删除 + if (System.IO.File.Exists(WaiBuJianKong.WaiBuJianKongTargetFileName)) + { + System.IO.File.Delete(WaiBuJianKong.WaiBuJianKongTargetFileName); + } + + // 重命名/移动文件 + System.IO.File.Move(SourceTxt, WaiBuJianKong.WaiBuJianKongTargetFileName); + } + } +} diff --git a/BLWLogProduce/Services/RoomStatusDataCollect.cs b/BLWLogProduce/Services/RoomStatusDataCollect.cs new file mode 100644 index 0000000..78f77b2 --- /dev/null +++ b/BLWLogProduce/Services/RoomStatusDataCollect.cs @@ -0,0 +1,26 @@ + +using Common; +using CommonEntity; +using Confluent.Kafka; +using static CSRedis.CSRedisClient; + +namespace BLWLogProduce.Services +{ + public class RoomStatusDataCollect : BackgroundService + { + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + await Task.Factory.StartNew((State) => + { + var DingYue = ("redis-udppackage-roomstatus-takecardstatus", new Action((args) => + { + string body = args.Body; + string TopicKey = KafkaKey.BLWLog_RCU_Topic; + string DetailKey = KafkaKey.UDPPackageKey; + })); + CSRedisCacheHelper.redis.Subscribe(DingYue); + + }, TaskCreationOptions.LongRunning, stoppingToken); + } + } +} diff --git a/BLWLogProduce/WeatherForecast.cs b/BLWLogProduce/WeatherForecast.cs new file mode 100644 index 0000000..7876dcb --- /dev/null +++ b/BLWLogProduce/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace BLWLogProduce +{ + public class WeatherForecast + { + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} diff --git a/BLWLogProduce/appsettings.Development.json b/BLWLogProduce/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/BLWLogProduce/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/BLWLogProduce/appsettings.json b/BLWLogProduce/appsettings.json new file mode 100644 index 0000000..7a633a2 --- /dev/null +++ b/BLWLogProduce/appsettings.json @@ -0,0 +1,14 @@ +{ + "Kafka": { + "EndPoint": "43.138.217.154:9092", + "UserName": "blwmomo", + "PassWord": "blwmomo" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/BLWLogProduce/nlog.config b/BLWLogProduce/nlog.config new file mode 100644 index 0000000..3a1832e --- /dev/null +++ b/BLWLogProduce/nlog.config @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/BLWLogServer.sln b/BLWLogServer.sln new file mode 100644 index 0000000..0ed1f42 --- /dev/null +++ b/BLWLogServer.sln @@ -0,0 +1,169 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35527.113 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BLWLogServer", "BLWLogServer\BLWLogServer.csproj", "{D33FA88D-31DB-409A-95FA-214D15171F79}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "发布", "ConsoleApp1\发布.csproj", "{80D28F4F-F594-4AE6-AFAF-F59B7D03394D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonEntity", "CommonEntity\CommonEntity.csproj", "{CB8D64BC-44CD-49AF-AABF-EDB9EA334B27}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonTools", "CommonTools\CommonTools.csproj", "{A6767165-2F2D-49E9-9B6A-5067EDFBFF72}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BLWLogProduce", "BLWLogProduce\BLWLogProduce.csproj", "{52E3DD36-04F3-4CCC-B415-FE6727CB19A3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "心跳维持", "心跳维持\心跳维持.csproj", "{8618E474-C3A9-4D25-8DA3-38D9DFA18325}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UseSQLQueryData", "UseSQLQueryData\UseSQLQueryData.csproj", "{10F5F2CB-A414-43DB-A99A-68081F2800FC}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "guolv", "guolv\guolv.fsproj", "{37EE528E-A087-424D-B8B9-5DDC33FBD48A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp2", "ConsoleApp2\ConsoleApp2.csproj", "{07B30240-4F9E-429F-A379-41CB26755B37}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp3", "ConsoleApp3\ConsoleApp3.csproj", "{03733DB0-C0EC-40DA-8EB3-8C792D6937A4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "回收", "回收\回收.csproj", "{72F978EB-70A1-44EC-9C20-668626CC554A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DAL", "DAL\DAL.csproj", "{CBBE945C-3CA3-4718-99CD-EEA4C8A9C2D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "duoge", "duoge\duoge.csproj", "{5EB24BC7-BA77-4A7B-B8A3-93019C658AA9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Faster", "Faster\Faster.csproj", "{F2695AB4-03C7-4F5F-B040-F9443730F082}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyNLua", "MyNLua\MyNLua.csproj", "{088CF6E8-C26C-44E1-9874-ABC7EF627AF8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyErl", "MyErl\MyErl.csproj", "{191BC89F-2A03-4422-A2A0-327016B6971F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "消费", "消费\消费.csproj", "{9E50411B-77D4-4675-8F3A-F6245E51F9A8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mypwsh", "mypwsh\mypwsh.csproj", "{FAEDFC96-E7AE-46EF-91BE-9587CE98DA65}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApiService", "ApiService\ApiService.csproj", "{9E3EF7AE-7049-44F2-82C8-C30FE97C172F}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FDemo", "FDemo\FDemo.fsproj", "{69FEBEBD-5BC4-4DFE-8622-0C1CF49B6652}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyFaster", "MyFaster\MyFaster.csproj", "{A10993F0-828F-4ADF-A226-49C438D83FA7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FasterClient", "FasterClient\FasterClient.csproj", "{C88D6C3D-46C9-4382-A3D3-A933CCFB8748}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyFunctioncache", "MyFunctioncache\MyFunctioncache.csproj", "{5E42AFEC-5EFC-4001-AAA0-88ADFC2F1890}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FanShe", "FanShe\FanShe.csproj", "{8186F600-16FE-4169-8609-31ECB6685FBF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApplication1", "WebApplication1\WebApplication1.csproj", "{8D19D452-2287-401B-A46A-2768B17010F7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D33FA88D-31DB-409A-95FA-214D15171F79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D33FA88D-31DB-409A-95FA-214D15171F79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D33FA88D-31DB-409A-95FA-214D15171F79}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D33FA88D-31DB-409A-95FA-214D15171F79}.Release|Any CPU.Build.0 = Release|Any CPU + {80D28F4F-F594-4AE6-AFAF-F59B7D03394D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {80D28F4F-F594-4AE6-AFAF-F59B7D03394D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {80D28F4F-F594-4AE6-AFAF-F59B7D03394D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {80D28F4F-F594-4AE6-AFAF-F59B7D03394D}.Release|Any CPU.Build.0 = Release|Any CPU + {CB8D64BC-44CD-49AF-AABF-EDB9EA334B27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB8D64BC-44CD-49AF-AABF-EDB9EA334B27}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB8D64BC-44CD-49AF-AABF-EDB9EA334B27}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB8D64BC-44CD-49AF-AABF-EDB9EA334B27}.Release|Any CPU.Build.0 = Release|Any CPU + {A6767165-2F2D-49E9-9B6A-5067EDFBFF72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6767165-2F2D-49E9-9B6A-5067EDFBFF72}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6767165-2F2D-49E9-9B6A-5067EDFBFF72}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6767165-2F2D-49E9-9B6A-5067EDFBFF72}.Release|Any CPU.Build.0 = Release|Any CPU + {52E3DD36-04F3-4CCC-B415-FE6727CB19A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52E3DD36-04F3-4CCC-B415-FE6727CB19A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52E3DD36-04F3-4CCC-B415-FE6727CB19A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52E3DD36-04F3-4CCC-B415-FE6727CB19A3}.Release|Any CPU.Build.0 = Release|Any CPU + {8618E474-C3A9-4D25-8DA3-38D9DFA18325}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8618E474-C3A9-4D25-8DA3-38D9DFA18325}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8618E474-C3A9-4D25-8DA3-38D9DFA18325}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8618E474-C3A9-4D25-8DA3-38D9DFA18325}.Release|Any CPU.Build.0 = Release|Any CPU + {10F5F2CB-A414-43DB-A99A-68081F2800FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {10F5F2CB-A414-43DB-A99A-68081F2800FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {10F5F2CB-A414-43DB-A99A-68081F2800FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {10F5F2CB-A414-43DB-A99A-68081F2800FC}.Release|Any CPU.Build.0 = Release|Any CPU + {37EE528E-A087-424D-B8B9-5DDC33FBD48A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {37EE528E-A087-424D-B8B9-5DDC33FBD48A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {37EE528E-A087-424D-B8B9-5DDC33FBD48A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {37EE528E-A087-424D-B8B9-5DDC33FBD48A}.Release|Any CPU.Build.0 = Release|Any CPU + {07B30240-4F9E-429F-A379-41CB26755B37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07B30240-4F9E-429F-A379-41CB26755B37}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07B30240-4F9E-429F-A379-41CB26755B37}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07B30240-4F9E-429F-A379-41CB26755B37}.Release|Any CPU.Build.0 = Release|Any CPU + {03733DB0-C0EC-40DA-8EB3-8C792D6937A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {03733DB0-C0EC-40DA-8EB3-8C792D6937A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {03733DB0-C0EC-40DA-8EB3-8C792D6937A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {03733DB0-C0EC-40DA-8EB3-8C792D6937A4}.Release|Any CPU.Build.0 = Release|Any CPU + {72F978EB-70A1-44EC-9C20-668626CC554A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {72F978EB-70A1-44EC-9C20-668626CC554A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {72F978EB-70A1-44EC-9C20-668626CC554A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {72F978EB-70A1-44EC-9C20-668626CC554A}.Release|Any CPU.Build.0 = Release|Any CPU + {CBBE945C-3CA3-4718-99CD-EEA4C8A9C2D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CBBE945C-3CA3-4718-99CD-EEA4C8A9C2D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CBBE945C-3CA3-4718-99CD-EEA4C8A9C2D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CBBE945C-3CA3-4718-99CD-EEA4C8A9C2D1}.Release|Any CPU.Build.0 = Release|Any CPU + {5EB24BC7-BA77-4A7B-B8A3-93019C658AA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EB24BC7-BA77-4A7B-B8A3-93019C658AA9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EB24BC7-BA77-4A7B-B8A3-93019C658AA9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EB24BC7-BA77-4A7B-B8A3-93019C658AA9}.Release|Any CPU.Build.0 = Release|Any CPU + {F2695AB4-03C7-4F5F-B040-F9443730F082}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2695AB4-03C7-4F5F-B040-F9443730F082}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2695AB4-03C7-4F5F-B040-F9443730F082}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F2695AB4-03C7-4F5F-B040-F9443730F082}.Release|Any CPU.Build.0 = Release|Any CPU + {088CF6E8-C26C-44E1-9874-ABC7EF627AF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {088CF6E8-C26C-44E1-9874-ABC7EF627AF8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {088CF6E8-C26C-44E1-9874-ABC7EF627AF8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {088CF6E8-C26C-44E1-9874-ABC7EF627AF8}.Release|Any CPU.Build.0 = Release|Any CPU + {191BC89F-2A03-4422-A2A0-327016B6971F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {191BC89F-2A03-4422-A2A0-327016B6971F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {191BC89F-2A03-4422-A2A0-327016B6971F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {191BC89F-2A03-4422-A2A0-327016B6971F}.Release|Any CPU.Build.0 = Release|Any CPU + {9E50411B-77D4-4675-8F3A-F6245E51F9A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9E50411B-77D4-4675-8F3A-F6245E51F9A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9E50411B-77D4-4675-8F3A-F6245E51F9A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9E50411B-77D4-4675-8F3A-F6245E51F9A8}.Release|Any CPU.Build.0 = Release|Any CPU + {FAEDFC96-E7AE-46EF-91BE-9587CE98DA65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FAEDFC96-E7AE-46EF-91BE-9587CE98DA65}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FAEDFC96-E7AE-46EF-91BE-9587CE98DA65}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FAEDFC96-E7AE-46EF-91BE-9587CE98DA65}.Release|Any CPU.Build.0 = Release|Any CPU + {9E3EF7AE-7049-44F2-82C8-C30FE97C172F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9E3EF7AE-7049-44F2-82C8-C30FE97C172F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9E3EF7AE-7049-44F2-82C8-C30FE97C172F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9E3EF7AE-7049-44F2-82C8-C30FE97C172F}.Release|Any CPU.Build.0 = Release|Any CPU + {69FEBEBD-5BC4-4DFE-8622-0C1CF49B6652}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {69FEBEBD-5BC4-4DFE-8622-0C1CF49B6652}.Debug|Any CPU.Build.0 = Debug|Any CPU + {69FEBEBD-5BC4-4DFE-8622-0C1CF49B6652}.Release|Any CPU.ActiveCfg = Release|Any CPU + {69FEBEBD-5BC4-4DFE-8622-0C1CF49B6652}.Release|Any CPU.Build.0 = Release|Any CPU + {A10993F0-828F-4ADF-A226-49C438D83FA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A10993F0-828F-4ADF-A226-49C438D83FA7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A10993F0-828F-4ADF-A226-49C438D83FA7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A10993F0-828F-4ADF-A226-49C438D83FA7}.Release|Any CPU.Build.0 = Release|Any CPU + {C88D6C3D-46C9-4382-A3D3-A933CCFB8748}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C88D6C3D-46C9-4382-A3D3-A933CCFB8748}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C88D6C3D-46C9-4382-A3D3-A933CCFB8748}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C88D6C3D-46C9-4382-A3D3-A933CCFB8748}.Release|Any CPU.Build.0 = Release|Any CPU + {5E42AFEC-5EFC-4001-AAA0-88ADFC2F1890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5E42AFEC-5EFC-4001-AAA0-88ADFC2F1890}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5E42AFEC-5EFC-4001-AAA0-88ADFC2F1890}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5E42AFEC-5EFC-4001-AAA0-88ADFC2F1890}.Release|Any CPU.Build.0 = Release|Any CPU + {8186F600-16FE-4169-8609-31ECB6685FBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8186F600-16FE-4169-8609-31ECB6685FBF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8186F600-16FE-4169-8609-31ECB6685FBF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8186F600-16FE-4169-8609-31ECB6685FBF}.Release|Any CPU.Build.0 = Release|Any CPU + {8D19D452-2287-401B-A46A-2768B17010F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8D19D452-2287-401B-A46A-2768B17010F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8D19D452-2287-401B-A46A-2768B17010F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8D19D452-2287-401B-A46A-2768B17010F7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8C8E091C-7402-4A24-AF5A-53F0B3C1D447} + EndGlobalSection +EndGlobal diff --git a/BLWLogServer.suo b/BLWLogServer.suo new file mode 100644 index 0000000..06e3ea8 Binary files /dev/null and b/BLWLogServer.suo differ diff --git a/BLWLogServer/.config/dotnet-tools.json b/BLWLogServer/.config/dotnet-tools.json new file mode 100644 index 0000000..fa9cd18 --- /dev/null +++ b/BLWLogServer/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "9.0.7", + "commands": [ + "dotnet-ef" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/BLWLogServer/BLWLogServer.csproj b/BLWLogServer/BLWLogServer.csproj new file mode 100644 index 0000000..81d9da8 --- /dev/null +++ b/BLWLogServer/BLWLogServer.csproj @@ -0,0 +1,27 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + diff --git a/BLWLogServer/BLWLogServer.csproj.user b/BLWLogServer/BLWLogServer.csproj.user new file mode 100644 index 0000000..639430f --- /dev/null +++ b/BLWLogServer/BLWLogServer.csproj.user @@ -0,0 +1,8 @@ + + + + E:\tian\BLS\BLWLogServer\BLWLogServer\Properties\PublishProfiles\FolderProfile.pubxml + ApiControllerEmptyScaffolder + root/Common/Api + + \ No newline at end of file diff --git a/BLWLogServer/BLWLogServer.http b/BLWLogServer/BLWLogServer.http new file mode 100644 index 0000000..e1916e7 --- /dev/null +++ b/BLWLogServer/BLWLogServer.http @@ -0,0 +1,6 @@ +@BLWLogServer_HostAddress = http://localhost:5245 + +GET {{BLWLogServer_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/BLWLogServer/Controllers/PowerController.cs b/BLWLogServer/Controllers/PowerController.cs new file mode 100644 index 0000000..7c87f5f --- /dev/null +++ b/BLWLogServer/Controllers/PowerController.cs @@ -0,0 +1,54 @@ +using CommonEntity; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using MongoDB.Driver; + +namespace BLWLogServer.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class PowerController : ControllerBase + { + public IMongoClient _client; + public PowerController(IMongoClient mongo) + { + this._client = mongo; + } + [HttpPost()] + public ReturnInfo GetPowerAnalysis([FromBody] QueryDate query) + { + ReturnInfo r = new ReturnInfo(); + try + { + int size = query.PageSize; + int index = query.PageIndex; + string st = query.Start_Time; + string et = query.End_Time; + DateTime sst = DateTime.Parse(st); + DateTime eet = DateTime.Parse(et); + var collection = _client.GetDatabase("udppackage").GetCollection("powermonitor"); + //构建查询条件 + long code = 0; + long.TryParse(query.HotelCode,out code); + + var filter = Builders.Filter.And( + Builders.Filter.Gt(x => x.ReportTime, sst), + Builders.Filter.Lt(x => x.ReportTime, eet), + Builders.Filter.Eq(x => x.HotelCode, code) + ); + + long totalCount = collection.CountDocuments(filter); + var results = collection.Find(filter).ToList(); // 跳过前面的记录 + r.isok = true; + r.response = results; + } + catch (Exception ex) + { + + r.isok = false; + r.message = ex.Message; + } + return r; + } + } +} diff --git a/BLWLogServer/Controllers/UDPPackageController.cs b/BLWLogServer/Controllers/UDPPackageController.cs new file mode 100644 index 0000000..3b17e9b --- /dev/null +++ b/BLWLogServer/Controllers/UDPPackageController.cs @@ -0,0 +1,977 @@ +using System; +using CommonEntity; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using MongoDB.Driver; +using MongoDB.Driver.Linq; +using Newtonsoft.Json; +using NPOI.SS.UserModel; +using NPOI.XSSF.UserModel; +using RestSharp; + +namespace BLWLogServer.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class UDPPackageController : ControllerBase + { + public IMongoClient _client; + public UDPPackageController(IMongoClient mongo) + { + this._client = mongo; + } + [HttpPost()] + public ReturnInfo GetUDPTotalAnalysis([FromBody] QueryDate query) + { + ReturnInfo r = new ReturnInfo(); + try + { + int size = query.PageSize; + int index = query.PageIndex; + string st = query.Start_Time; + string et = query.End_Time; + DateTime sst = DateTime.Parse(st); + DateTime eet = DateTime.Parse(et); + var collection = _client.GetDatabase("udppackage").GetCollection("totalcount"); + //构建查询条件 + + var filter = Builders.Filter.And( + Builders.Filter.Gt(x => x.RemoveTime, sst), + Builders.Filter.Lt(x => x.RemoveTime, eet) + ); + + // 获取总记录数(可选,用于前端分页显示总页数) + long totalCount = collection.CountDocuments(filter); + // //执行查询 + //var results = collection.Find(filter).Skip((index - 1) * size) // 跳过前面的记录 + //.Limit(size).ToList(); // 限制返回的记录数.ToList(); + var results = collection.Find(filter).ToList(); // 跳过前面的记录 + r.isok = true; + r.response = results; + } + catch (Exception ex) + { + + r.isok = false; + r.message = ex.Message; + } + return r; + } + + + [HttpPost()] + public ReturnInfo GetUDPPackageTimeAnalysis([FromBody] QueryDate query) + { + ReturnInfo r = new ReturnInfo(); + try + { + int size = query.PageSize; + int index = query.PageIndex; + string st = query.Start_Time; + string et = query.End_Time; + DateTime sst = DateTime.Parse(st); + DateTime eet = DateTime.Parse(et); + var collection = _client.GetDatabase("udppackage").GetCollection("zeroe_stepmonitor"); + //构建查询条件 + + var filter = Builders.Filter.And( + Builders.Filter.Gt(x => x.TriggerTime, sst), + Builders.Filter.Lt(x => x.TriggerTime, eet) + ); + + // 获取总记录数(可选,用于前端分页显示总页数) + long totalCount = collection.CountDocuments(filter); + // //执行查询 + //var results = collection.Find(filter).Skip((index - 1) * size) // 跳过前面的记录 + //.Limit(size).ToList(); // 限制返回的记录数.ToList(); + + // 使用聚合管道实现分组、排序和分页 + //var aggregation = collection.Aggregate() + // .Match(filter) // 先筛选时间范围内的文档 + // .Group( + // x => x.MessageId, // 按MessageId分组 + // g => new + // { + // MessageId = g.Key, // 分组键 + // Items = g.ToList() // 分组内的所有文档 + // //Count = g.Count() // 每组的文档数 + // }) + // .Skip((index - 1) * size) // 分页跳过 + // .Limit(size); // 分页限制 + + var results = collection.Find(filter).ToList().OrderByDescending(A => A.TriggerTime); // 跳过前面的记录 + //var results = aggregation.ToList(); + var USA = results.GroupBy(A => A.MessageId); + r.isok = true; + r.response = USA.ToList(); + } + catch (Exception ex) + { + + r.isok = false; + r.message = ex.Message; + } + return r; + } + + + + /// + /// 获取语音IOT平台的数据 + /// + /// + /// + [HttpPost()] + public ReturnInfo Get_IOTLog([FromBody] LogQuery q) + { + ReturnInfo info = new ReturnInfo(); + info.isok = true; + try + { + List lg = new List(); + + string? st = q?.Start_Time; + string? et = q?.End_Time; + + int PageSize = q.PageSize; + int PageIndex = q.PageIndex; + + List c11 = q.CommandType; + + int AAA = (PageIndex - 1) * PageSize; + DateTime sst = DateTime.Parse(st); + DateTime eet = DateTime.Parse(et); + + + string? st1 = q?.Start_Time_Really; + string? et1 = q?.End_Time_Really; + DateTime sst1 = DateTime.Parse(st1); + DateTime eet1 = DateTime.Parse(et1); + if (eet < sst) + { + info.isok = false; + info.message = "结束时间不能大于开始时间"; + return info; + } + var qqqq = q?.Data; + + IAggregateFluent NNN = null; + var collection = _client.GetDatabase("udppackage").GetCollection("voiceiotlog"); + var pipeline = collection.Aggregate(); + NNN = pipeline.Match(s => s.CreateTime >= sst && s.CreateTime <= eet); + + if (qqqq?.Count > 0) + { + var orConditions = new List>(); + foreach (var item in qqqq) + { + if (!string.IsNullOrEmpty(item.HotelCode) && !string.IsNullOrEmpty(item.RoomNumber)) + { + var andCondition = Builders.Filter.And( + Builders.Filter.Eq("HotelCode", item.HotelCode), + Builders.Filter.Eq("RoomNumber", item.RoomNumber) + ); + orConditions.Add(andCondition); + } + else if (!string.IsNullOrEmpty(item.HotelCode) && string.IsNullOrEmpty(item.RoomNumber)) + { + var andCondition = Builders.Filter.And( + Builders.Filter.Eq("HotelCode", item.HotelCode) + ); + orConditions.Add(andCondition); + } + else + { + + } + } + var orFilter = Builders.Filter.Or(orConditions); + + NNN = NNN.Match(orFilter); + } + + var results = NNN.ToList().OrderByDescending(A => A.CreateTime); + var Q = results.ToList(); + + DevMonitorIOTLogResult_WITH_Count c = new DevMonitorIOTLogResult_WITH_Count(); + c.devMonitorLogResults = Q; + c.TotalCount = Q.Count; + + info.response = c; + } + catch (Exception ex) + { + info.isok = false; + info.message = ex.Message; + } + return info; + } + [HttpPost()] + public ReturnInfo Get_IOTLogCount([FromBody] LogQuery q) + { + ReturnInfo info = new ReturnInfo(); + info.isok = true; + try + { + List lg = new List(); + + string? st1 = q?.Start_Time_Really; + string? et1 = q?.End_Time_Really; + DateTime sst1 = DateTime.Parse(st1); + DateTime eet1 = DateTime.Parse(et1); + if (eet1 < sst1) + { + info.isok = false; + info.message = "结束时间不能大于开始时间"; + return info; + } + var qqqq = q?.Data; + + //var h11 = qqqq?.Select(x => x.HotelCode).Distinct().Where(A => !string.IsNullOrEmpty(A)).ToList(); + //var r11 = qqqq?.Select(x => x.RoomNumber).Distinct().Where(A => !string.IsNullOrEmpty(A)).ToList(); + + DevMonitorIOTLogResult_WITH_Count c = new DevMonitorIOTLogResult_WITH_Count(); + + var collection = _client.GetDatabase("udppackage").GetCollection("voiceiotlog"); + //构建查询条件 + if (q.IsQuery_Really) + { + + IAggregateFluent NNN = null; + var pipeline = collection.Aggregate(); + NNN = pipeline.Match(s => s.CreateTime >= sst1 && s.CreateTime <= eet1); + + //if (h11.Count > 0 && r11.Count == 0) + //{ + // NNN = pipeline.Match(s => s.CreateTime >= sst1 && s.CreateTime <= eet1 && h11.Contains(s.HotelCode.ToString())); + //} + //if (h11.Count > 0 && r11.Count > 0) + //{ + // NNN = pipeline.Match(s => s.CreateTime >= sst1 && s.CreateTime <= eet1 && h11.Contains(s.HotelCode.ToString()) && r11.Contains(s.RoomNumber)); + //} + + + // 2. 动态生成 HotelCode 和 HostNUMBER 的 OR 条件 + if (qqqq?.Count > 0) + { + var orConditions = new List>(); + foreach (var item in qqqq) + { + if (!string.IsNullOrEmpty(item.HotelCode) && !string.IsNullOrEmpty(item.RoomNumber)) + { + var andCondition = Builders.Filter.And( + Builders.Filter.Eq("HotelCode", item.HotelCode), + Builders.Filter.Eq("RoomNumber", item.RoomNumber) + ); + orConditions.Add(andCondition); + } + else if (!string.IsNullOrEmpty(item.HotelCode) && string.IsNullOrEmpty(item.RoomNumber)) + { + var andCondition = Builders.Filter.And( + Builders.Filter.Eq("HotelCode", item.HotelCode) + ); + orConditions.Add(andCondition); + } + else + { + + } + } + + // 将 OR 条件添加到管道 + var orFilter = Builders.Filter.Or(orConditions); + NNN = NNN.Match(orFilter); + } + + var MMM = NNN.Group( + s => s.RequestId, + g => new + { + RequestId = g.Key, + Count = g.Count(), + ContainsFive = g.Any(x => x.Step == 5) + } + ) + .SortByDescending(x => x.RequestId) + .ToList(); + + var NotContainStep5 = MMM.Where(A => !A.ContainsFive).Count(); + + var C = MMM.Sum(A => A.Count); + c.RequestIdCount = C; + c.RequestNotContainerCount = NotContainStep5; + } + else + { + c.RequestIdCount = 0; + } + info.response = c; + } + catch (Exception ex) + { + info.isok = false; + info.message = ex.Message; + } + return info; + } + + + /// + ///获取取电状态 + /// + /// + /// + [HttpPost()] + public async Task Get_TakeCardStatus([FromBody] LogQuery q) + { + ReturnInfo info = new ReturnInfo(); + info.isok = true; + try + { + List lg = new List(); + + string? st1 = q?.Start_Time; + string? et1 = q?.End_Time; + DateTime sst1 = DateTime.Parse(st1); + DateTime eet1 = DateTime.Parse(et1); + if (eet1 < sst1) + { + info.isok = false; + info.message = "结束时间不能大于开始时间"; + return info; + } + var qqqq = q?.Data; + var collection = _client.GetDatabase("udppackage").GetCollection("takecardlog"); + + // 定义多个条件组合 + // 动态条件列表 + + + FilterDefinition filter = Builders.Filter.And( + Builders.Filter.Gt(x => x.LastUpdateTime, sst1), + Builders.Filter.Lt(x => x.LastUpdateTime, eet1) + ); + + + var conditions = new List>(); + foreach (var item in qqqq) + { + if (!string.IsNullOrEmpty(item.HotelCode) && !string.IsNullOrEmpty(item.Key_HostNumber)) + { + var q1 = Builders.Filter.And( + Builders.Filter.Eq("HotelCode", item.HotelCode), + Builders.Filter.Eq("HostNUMBER", item.Key_HostNumber) + ); + conditions.Add(q1); + } + else if (!string.IsNullOrEmpty(item.HotelCode)) + { + var q1 = Builders.Filter.And( + Builders.Filter.Eq("HotelCode", item.HotelCode) + ); + conditions.Add(q1); + } + else + { + + } + } + + // 组合所有 HotelCode 和 HostNUMBER 的条件为 OR + var combinedHotelHostFilter = conditions.Count > 0 + ? Builders.Filter.Or(conditions) + : Builders.Filter.Empty; // 如果没有条件,则不限制 + + // 最终条件:时间范围 AND (HotelCode + HostNUMBER 的 OR 组合) + var finalFilter = Builders.Filter.And( + filter, + combinedHotelHostFilter + ); + + var dynamicResults = await collection.Find(finalFilter).ToListAsync(); + info.response = dynamicResults; + } + catch (Exception ex) + { + info.isok = false; + info.message = ex.Message; + } + return info; + } + + [HttpPost()] + public async Task Get_BeforeTakeCardStatus([FromBody] LogQuery q) + { + ReturnInfo info = new ReturnInfo(); + info.isok = true; + try + { + string? st1 = q?.Start_Time; + string? et1 = q?.End_Time; + DateTime sst1 = DateTime.Parse(st1); + DateTime eet1 = DateTime.Parse(et1); + if (eet1 < sst1) + { + info.isok = false; + info.message = "结束时间不能大于开始时间"; + return info; + } + var qqqq = q?.Data; + if (qqqq.Count > 1) + { + info.isok = false; + info.message = "只能查询单个房间"; + return info; + } + string? hotelcode = qqqq.FirstOrDefault()?.HotelCode; + string? hostnumber = qqqq.FirstOrDefault()?.Key_HostNumber; + + var collection1 = _client.GetDatabase("udppackage").GetCollection("takecardlog"); + var collection2 = _client.GetDatabase("udppackage").GetCollection("rcustatuslog"); + + FilterDefinition filter1 = Builders.Filter.And( + Builders.Filter.Lt(x => x.LastUpdateTime, sst1), + Builders.Filter.Eq(x => x.HotelCode, hotelcode), + Builders.Filter.Eq(x => x.HostNUMBER, hostnumber) + ); + var finalFilter1 = Builders.Filter.And(filter1); + var dynamicResults1 = await collection1.Find(finalFilter1).SortByDescending(x => x.LastUpdateTime).Limit(1).FirstOrDefaultAsync(); + + FilterDefinition filter2 = Builders.Filter.And( + Builders.Filter.Lt(x => x.CurrentTime, sst1), + Builders.Filter.Eq(x => x.HotelCode, hotelcode), + Builders.Filter.Eq(x => x.HostNumber, hostnumber) + ); + var finalFilter2 = Builders.Filter.And(filter2); + var dynamicResults2 = await collection2.Find(finalFilter2).SortByDescending(A => A.CurrentTime).Limit(1).FirstOrDefaultAsync(); + + info.response = new { RCUStatus = dynamicResults2, TakeCardStatus = dynamicResults1 }; + } + catch (Exception ex) + { + info.isok = false; + info.message = ex.Message; + } + return info; + } + + private static bool CreatePredicate(List items, string hotelcode, string hostnumber) + { + + List bools = new List(); + foreach (var item in items) + { + bool KKK = item.HotelCode.Equals(hotelcode) && item.Key_HostNumber.Equals(hostnumber); + bools.Add(KKK); + } + // 使用 Aggregate 将列表中的布尔值用 || 连接 + bool result = bools.Aggregate((current, next) => current || next); + return result; + } + + /// + /// RCU 连线,断线状态 + /// + /// + /// + [HttpPost()] + public async Task Get_RCUStatus([FromBody] LogQuery q) + { + ReturnInfo info = new ReturnInfo(); + info.isok = true; + try + { + string? st1 = q?.Start_Time; + string? et1 = q?.End_Time; + DateTime sst1 = DateTime.Parse(st1); + DateTime eet1 = DateTime.Parse(et1); + if (eet1 < sst1) + { + info.isok = false; + info.message = "结束时间不能大于开始时间"; + return info; + } + var qqq = q?.Data; + var collection = _client.GetDatabase("udppackage").GetCollection("rcustatuslog"); + + FilterDefinition filter = Builders.Filter.And( + Builders.Filter.Gt(x => x.CurrentTime, sst1), + Builders.Filter.Lt(x => x.CurrentTime, eet1) + ); + + var conditions = new List>(); + conditions.Add(filter); + + foreach (var item in qqq) + { + if (!string.IsNullOrEmpty(item.HotelCode) && string.IsNullOrEmpty(item.Key_HostNumber)) + { + var q1 = Builders.Filter.And( + Builders.Filter.Eq("HotelCode", item.HotelCode) + ); + conditions.Add(q1); + } + else if (!string.IsNullOrEmpty(item.HotelCode) && !string.IsNullOrEmpty(item.Key_HostNumber)) + { + var q1 = Builders.Filter.And( + Builders.Filter.Eq("HotelCode", item.HotelCode), + Builders.Filter.Eq("HostNumber", item.Key_HostNumber) + ); + conditions.Add(q1); + } + else + { + + } + } + + // 组合所有条件为 AND 关系(时间范围 + 其他条件) + var finalFilter = Builders.Filter.And(conditions); + + // 执行查询 + var dynamicResults = await collection.Find(finalFilter).ToListAsync(); + info.response = dynamicResults; + } + catch (Exception ex) + { + info.isok = false; + info.message = ex.Message; + } + return info; + } + public static string BaseUrl = "https://www.boonlive-rcu.com/"; + + + /// + /// 设置时间 + /// + /// + /// + [HttpPost()] + public async Task TongJiTimerIntervalSet(TimerData data) + { + ReturnInfo r = new ReturnInfo(); + try + { + var options = new RestClientOptions(BaseUrl); + var client = new RestClient(options); + + + var request = new RestRequest("api/TongJiTimerIntervalSet"); + request.AddParameter("interval_Minutes", data.interval_Minutes); + RestResponse response = await client.PostAsync(request); + string? str1 = response.Content; + r.isok = true; + r.response = str1; + } + catch (Exception ex) + { + r.isok = false; + r.response = ex.Message; + } + return r; + } + + + /// + /// 间隔多久的数据会被丢弃 + /// + /// + /// + [HttpPost()] + public async Task UDPLostDataIntervalSet(TimerData data) + { + ReturnInfo r = new ReturnInfo(); + try + { + var options = new RestClientOptions(BaseUrl); + var client = new RestClient(options); + + + var request = new RestRequest("api/DefineUDPLostDataInterval"); + request.AddParameter("Interval", data.interval_Minutes); + RestResponse response = await client.PostAsync(request); + string? str1 = response.Content; + r.isok = true; + r.response = str1; + } + catch (Exception ex) + { + r.isok = false; + r.response = ex.Message; + } + return r; + } + + /// + /// UDP 几包数据丢一包 + /// + /// + /// + + [HttpPost()] + public async Task UDPLostDataRateSet(TimerData data) + { + ReturnInfo r = new ReturnInfo(); + try + { + var options = new RestClientOptions(BaseUrl); + var client = new RestClient(options); + + + var request = new RestRequest("api/DefineUDPLostDataRate"); + request.AddParameter("LostHz", data.interval_Minutes); + RestResponse response = await client.PostAsync(request); + string? str1 = response.Content; + r.isok = true; + r.response = str1; + } + catch (Exception ex) + { + r.isok = false; + r.response = ex.Message; + } + return r; + } + + + /// + /// 同时设置3个数据 + /// + /// + /// + [HttpPost()] + public async Task ConfigParameterSet(List dataList) + { + ReturnInfo r = new ReturnInfo(); + try + { + var options = new RestClientOptions(BaseUrl); + var client = new RestClient(options); + foreach (var item in dataList) + { + string Key = item.key; + int V = item.value; + if (Key.Equals("超时08")) + { + var request = new RestRequest("api/DefineUDPLostDataInterval"); + request.AddParameter("Interval", V); + RestResponse response = await client.PostAsync(request); + } + if (Key.Equals("丢弃比例")) + { + var request = new RestRequest("api/DefineUDPLostDataRate"); + request.AddParameter("LostHz", V); + RestResponse response = await client.PostAsync(request); + } + if (Key.Equals("统计周期")) + { + var request = new RestRequest("api/TongJiTimerIntervalSet"); + request.AddParameter("interval_Minutes", V); + RestResponse response = await client.PostAsync(request); + } + } + r.isok = true; + r.response = "success"; + } + catch (Exception ex) + { + r.isok = false; + r.response = ex.Message; + } + return r; + } + + [HttpPost()] + [HttpPost()] + public IActionResult ExportUDPTotalAnalysis([FromBody] QueryDate query) + { + string tempFilePath = null; + + try + { + string st = query.Start_Time; + string et = query.End_Time; + DateTime sst = DateTime.Parse(st); + DateTime eet = DateTime.Parse(et); + + var collection = _client.GetDatabase("udppackage").GetCollection("totalcount"); + + // 构建查询条件 + var filter = Builders.Filter.And( + Builders.Filter.Gt(x => x.RemoveTime, sst), + Builders.Filter.Lt(x => x.RemoveTime, eet) + ); + + // 获取所有记录 + var allResults = collection.Find(filter).ToList(); + + if (allResults == null || allResults.Count == 0) + { + return NotFound("没有找到数据"); + } + + // 转换数据为二维表格格式 + var transformedData = TransformDataForExport(allResults); + + // 创建临时文件 + tempFilePath = Path.GetTempFileName() + ".xlsx"; + + // 生成Excel文件到临时文件 + using (var fileStream = new FileStream(tempFilePath, FileMode.Create, FileAccess.Write)) + { + var workbook = CreateExcelWorkbook(transformedData); + workbook.Write(fileStream); + } + + // 读取临时文件内容到内存流 + var fileBytes = System.IO.File.ReadAllBytes(tempFilePath); + var memoryStream = new MemoryStream(fileBytes); + + // 返回Excel文件 + return File(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + $"UDP数据统计_{DateTime.Now:yyyyMMdd_HHmmss}.xlsx"); + } + catch (Exception ex) + { + return StatusCode(500, $"导出失败: {ex.Message}"); + } + finally + { + // 清理临时文件 + if (tempFilePath != null && System.IO.File.Exists(tempFilePath)) + { + try + { + System.IO.File.Delete(tempFilePath); + } + catch + { + // 忽略删除失败的情况 + } + } + } + } + + // 数据转换方法(类似前端的transformData逻辑) + private List TransformDataForExport(List data) + { + // 提取所有唯一的commandType + var types = data.Select(item => item.CommandType).Distinct().ToList(); + + // 按分钟间隔分组 + var groupedByTime = new Dictionary(); + + foreach (var item in data) + { + // 获取时间对象 + var time = item.RemoveTime; + + // 精确到分钟的时间格式 + var repTime = time.ToString("yyyy-MM-dd HH:mm"); + + if (!groupedByTime.ContainsKey(repTime)) + { + groupedByTime[repTime] = new ExportDataRow + { + RemoveTime = repTime, + // 初始化所有类型为0L (使用long类型) + TypeValues = types.ToDictionary(type => type, _ => 0L) + }; + } + + // 累加对应类型的值 - 使用long类型 + if (groupedByTime[repTime].TypeValues.ContainsKey(item.CommandType)) + { + groupedByTime[repTime].TypeValues[item.CommandType] += item.TotalCount; + } + } + + // 排序时间(从最新到最早) + return groupedByTime.Values + .OrderByDescending(row => DateTime.Parse(row.RemoveTime)) + .ToList(); + } + + // 创建Excel工作簿 + // 创建Excel工作簿 - 美化版本 + private IWorkbook CreateExcelWorkbook(List data) + { + var workbook = new XSSFWorkbook(); + + // 创建单元格样式 + var headerStyle = CreateHeaderStyle(workbook); + var evenRowStyle = CreateCellStyle(workbook, IndexedColors.LightCornflowerBlue.Index); + var oddRowStyle = CreateCellStyle(workbook, IndexedColors.White.Index); + var dateStyle = CreateCellStyle(workbook, IndexedColors.White.Index, true); + + var sheet = workbook.CreateSheet("UDP数据统计"); + + // 获取所有唯一的命令类型 + var allTypes = data.SelectMany(row => row.TypeValues.Keys).Distinct().ToList(); + + // 创建表头 + var headerRow = sheet.CreateRow(0); + headerRow.HeightInPoints = 20; // 设置行高 + + // 时间段列 + var timeCell = headerRow.CreateCell(0); + timeCell.SetCellValue("时间段"); + timeCell.CellStyle = headerStyle; + + // 命令类型列 + for (int i = 0; i < allTypes.Count; i++) + { + var cell = headerRow.CreateCell(i + 1); + cell.SetCellValue(GetShortTypeName(allTypes[i])); + cell.CellStyle = headerStyle; + } + + // 填充数据 + for (int i = 0; i < data.Count; i++) + { + var dataRow = sheet.CreateRow(i + 1); + dataRow.HeightInPoints = 18; // 设置数据行高度 + + // 时间段单元格 + var timeDataCell = dataRow.CreateCell(0); + timeDataCell.SetCellValue(data[i].RemoveTime); + timeDataCell.CellStyle = dateStyle; + + // 交替行颜色 - 斑马纹效果 + var rowStyle = (i % 2 == 0) ? evenRowStyle : oddRowStyle; + + for (int j = 0; j < allTypes.Count; j++) + { + var type = allTypes[j]; + var value = data[i].TypeValues.ContainsKey(type) ? data[i].TypeValues[type] : 0L; + + var dataCell = dataRow.CreateCell(j + 1); + dataCell.SetCellValue(value); + dataCell.CellStyle = rowStyle; + } + } + + // 设置列宽 - 更精确的自适应 + sheet.SetColumnWidth(0, 20 * 256); // 时间段列固定宽度 + + for (int i = 0; i < allTypes.Count; i++) + { + // 根据列名长度设置宽度 + var colName = GetShortTypeName(allTypes[i]); + int width = Math.Max(10, Math.Min(25, colName.Length + 2)) * 256; + sheet.SetColumnWidth(i + 1, width); + } + + // 冻结表头行 + sheet.CreateFreezePane(0, 1, 0, 1); + + return workbook; + } + + // 创建表头样式 + private ICellStyle CreateHeaderStyle(IWorkbook workbook) + { + var style = workbook.CreateCellStyle(); + + // 设置背景色 + style.FillForegroundColor = IndexedColors.DarkBlue.Index; + style.FillPattern = FillPattern.SolidForeground; + + // 设置字体 + var font = workbook.CreateFont(); + font.FontName = "Arial"; + font.FontHeightInPoints = 11; + font.Boldweight = (short)FontBoldWeight.Bold; + font.Color = IndexedColors.White.Index; + style.SetFont(font); + + // 设置边框 + style.BorderBottom = BorderStyle.Medium; + style.BorderLeft = BorderStyle.Medium; + style.BorderRight = BorderStyle.Medium; + style.BorderTop = BorderStyle.Medium; + style.BottomBorderColor = IndexedColors.Black.Index; + style.LeftBorderColor = IndexedColors.Black.Index; + style.RightBorderColor = IndexedColors.Black.Index; + style.TopBorderColor = IndexedColors.Black.Index; + + // 设置对齐方式 + style.Alignment = HorizontalAlignment.Center; + style.VerticalAlignment = VerticalAlignment.Center; + + return style; + } + + // 创建单元格样式 + private ICellStyle CreateCellStyle(IWorkbook workbook, short backgroundColor, bool isDateCell = false) + { + var style = workbook.CreateCellStyle(); + + // 设置背景色 + style.FillForegroundColor = backgroundColor; + style.FillPattern = FillPattern.SolidForeground; + + // 设置字体 + var font = workbook.CreateFont(); + font.FontName = "Arial"; + font.FontHeightInPoints = 10; + style.SetFont(font); + + // 设置边框 + style.BorderBottom = BorderStyle.Thin; + style.BorderLeft = BorderStyle.Thin; + style.BorderRight = BorderStyle.Thin; + style.BorderTop = BorderStyle.Thin; + style.BottomBorderColor = IndexedColors.Grey40Percent.Index; + style.LeftBorderColor = IndexedColors.Grey40Percent.Index; + style.RightBorderColor = IndexedColors.Grey40Percent.Index; + style.TopBorderColor = IndexedColors.Grey40Percent.Index; + + // 设置对齐方式 + if (isDateCell) + { + style.Alignment = HorizontalAlignment.Left; + } + else + { + style.Alignment = HorizontalAlignment.Center; + } + style.VerticalAlignment = VerticalAlignment.Center; + + // 设置数据格式 + if (!isDateCell) + { + var format = workbook.CreateDataFormat(); + style.DataFormat = format.GetFormat("0"); // 数字格式,不显示小数 + } + + return style; + } + + // 获取简化的类型名称(类似前端的getShortType方法) + private string GetShortTypeName(string type) + { + // 这里实现您的类型名称简化逻辑 + // 例如,可以基于您的keyValueMap进行映射 + if (type.Contains('_')) + { + return type.Split('_').Last(); + } + return type; + } + + + } + // 导出数据行类 + public class ExportDataRow + { + public string RemoveTime { get; set; } + public Dictionary TypeValues { get; set; } + } + public class TTT + { + public string key { get; set; } + public int value { get; set; } + } +} diff --git a/BLWLogServer/Controllers/ValuesController.cs b/BLWLogServer/Controllers/ValuesController.cs new file mode 100644 index 0000000..b72c250 --- /dev/null +++ b/BLWLogServer/Controllers/ValuesController.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace BLWLogServer.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class ValuesController : ControllerBase + { + [HttpPost()] + public string HeartBeat() + { + return "hello"; + } + } +} diff --git a/BLWLogServer/Controllers/WeatherForecastController.cs b/BLWLogServer/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..d0d3982 --- /dev/null +++ b/BLWLogServer/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BLWLogServer.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} diff --git a/BLWLogServer/NLog.xsd b/BLWLogServer/NLog.xsd new file mode 100644 index 0000000..43f470d --- /dev/null +++ b/BLWLogServer/NLog.xsd @@ -0,0 +1,5069 @@ + + + + + + + + + + + + + + + + Watch config file for changes and reload automatically. + + + + + Print internal NLog messages to the console. Default value is: false + + + + + Print internal NLog messages to the console error output. Default value is: false + + + + + Write internal NLog messages to the specified file. + + + + + Log level threshold for internal log messages. Default value is: Info. + + + + + Global log level threshold for application log messages. Messages below this level won't be logged. + + + + + Throw an exception when there is an internal error. Default value is: false. Not recommend to set to true in production! + + + + + Throw an exception when there is a configuration error. If not set, determined by throwExceptions. + + + + + Gets or sets a value indicating whether Variables should be kept on configuration reload. Default value is: false. + + + + + Write internal NLog messages to the System.Diagnostics.Trace. Default value is: false. + + + + + Write timestamps for internal NLog messages. Default value is: true. + + + + + Use InvariantCulture as default culture instead of CurrentCulture. Default value is: false. + + + + + Perform message template parsing and formatting of LogEvent messages (true = Always, false = Never, empty = Auto Detect). Default value is: empty. + + + + + + + + + + + + + + Make all targets within this section asynchronous (creates additional threads but the calling thread isn't blocked by any target writes). + + + + + + + + + + + + + + + + + Prefix for targets/layout renderers/filters/conditions loaded from this assembly. + + + + + Load NLog extensions from the specified file (*.dll) + + + + + Load NLog extensions from the specified assembly. Assembly name should be fully qualified. + + + + + + + + + + Filter on the name of the logger. May include wildcard characters ('*' or '?'). + + + + + Comma separated list of levels that this rule matches. + + + + + Minimum level that this rule matches. + + + + + Maximum level that this rule matches. + + + + + Level that this rule matches. + + + + + Comma separated list of target names. + + + + + Ignore further rules if this one matches. + + + + + Enable this rule. Note: disabled rules aren't available from the API. + + + + + Rule identifier to allow rule lookup with Configuration.FindRuleByName and Configuration.RemoveRuleByName. + + + + + Loggers matching will be restricted to specified minimum level for following rules. + + + + + + + + + + + + + + + Default action if none of the filters match. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the file to be included. You could use * wildcard. The name is relative to the name of the current config file. + + + + + Ignore any errors in the include file. + + + + + + + + Variable value. Note, the 'value' attribute has precedence over this one. + + + + + Layout type variable value. Note, the 'value' attribute has precedence over this one. + + + + + + Variable name. + + + + + Variable value. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Maximum number of log events that the buffer can keep. + + + + + Number of log events to be buffered. + + + + + Indicates whether buffer should grow as needed. + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Action to be taken when the lazy writer thread request queue count exceeds the set limit. + + + + + Limit on the number of requests in the lazy writer thread request queue. + + + + + Number of log events that should be processed in a batch by the lazy writer thread. + + + + + Whether to use the locking queue, instead of a lock-free concurrent queue + + + + + Number of batches of P:NLog.Targets.Wrappers.AsyncTargetWrapper.BatchSize to write before yielding into P:NLog.Targets.Wrappers.AsyncTargetWrapper.TimeToSleepBetweenBatches + + + + + Time in milliseconds to sleep between batches. (1 or less means trigger on new activity) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Name of the file to write to. + + + + + Header. + + + + + Footer. + + + + + Whether to write the Header on initial creation of file appender, even if the file is not empty. Default value is false, which means only write header when initial file is empty (Ex. ensures valid CSV files) + + + + + Indicates whether the footer should be written only when the file is archived. + + + + + Maximum days of archive files that should be kept. Zero or negative means disabled. + + + + + Format-string to convert archive sequence-number by using string.Format + + + + + Maximum number of archive files that should be kept. Negative means disabled. + + + + + Legacy archive logic where file-archive-logic moves active file to path specified by P:NLog.Targets.FileTarget.ArchiveFileName, and then recreates the active file. Use P:NLog.Targets.FileTarget.ArchiveSuffixFormat to control suffix format, instead of now obsolete token {#} + + + + + Indicates whether to trigger archive operation based on time-period, by moving active-file to file-path specified by P:NLog.Targets.FileTarget.ArchiveFileName + + + + + Size in bytes above which log files will be automatically archived. Zero or negative means disabled. + + + + + Indicates whether any existing log-file should be archived on startup. + + + + + Indicates whether concurrent writes to the log file by multiple processes on the same host. + + + + + + Whether or not this target should just discard all data that its asked to write. Mostly used for when testing NLog Stack except final write + + + + + Indicates whether to write BOM (byte order mark) in created files. + + + + + Indicates whether to enable log file(s) to be deleted. + + + + + Indicates whether to delete old log file on startup. + + + + + Indicates whether to create directories if they do not exist. + + + + + File encoding. + + + + + Indicates whether to replace file contents on each write instead of appending log message at the end. + + + + + Line ending mode. + + + + + Maximum number of seconds that files are kept open. Zero or negative means disabled. + + + + + Log file buffer size in bytes. + + + + + Indicates whether to automatically flush the file buffers after each log message. + + + + + Indicates whether to keep log file open instead of opening and closing it on each logging event. + + + + + Maximum number of seconds before open files are flushed. Zero or negative means disabled. + + + + + Maximum number of files to be kept open. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Delay the flush until the LogEvent has been confirmed as written + + + + + Condition expression. Log events who meet this condition will cause a flush on the wrapped target. + + + + + Only flush when LogEvent matches condition. Ignore explicit-flush, config-reload-flush and shutdown-flush + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Number of log events to be buffered. + + + + + Action to take if the buffer overflows. + + + + + Timeout (in milliseconds) after which the contents of buffer will be flushed if there's no write in the specified period of time. Use -1 to disable timed flushes. + + + + + Indicates whether to use sliding timeout. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + Indicates whether to auto-check if the console is available. - Disables console writing if Environment.UserInteractive = false (Windows Service) - Disables console writing if Console Standard Input is not available (Non-Console-App) + + + + + Enables output using ANSI Color Codes + + + + + The encoding for writing messages to the T:System.Console. + + + + + Support NO_COLOR=1 environment variable. See also https://no-color.org/ + + + + + Indicates whether to send the log messages to the standard error instead of the standard output. + + + + + Indicates whether to auto-flush after M:System.Console.WriteLine + + + + + Indicates whether to auto-check if the console has been redirected to file - Disables coloring logic when System.Console.IsOutputRedirected = true + + + + + Indicates whether to use default row highlighting rules. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Background color. + + + + + Condition that must be met in order to set the specified foreground and background color. + + + + + Foreground color. + + + + + + + + + + + + + + + Background color. + + + + + Condition that must be met before scanning the row for highlight of words + + + + + Foreground color. + + + + + Indicates whether to ignore case when comparing texts. + + + + + Text to be matched. You must specify either text or regex. + + + + + Indicates whether to match whole words only. + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + Indicates whether to auto-flush after M:System.Console.WriteLine + + + + + Indicates whether to auto-check if the console is available - Disables console writing if Environment.UserInteractive = false (Windows Service) - Disables console writing if Console Standard Input is not available (Non-Console-App) + + + + + The encoding for writing messages to the T:System.Console. + + + + + Whether to force M:System.Console.WriteLine (slower) instead of the faster internal buffering. + + + + + Indicates whether to send the log messages to the standard error instead of the standard output. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Database user name. If the ConnectionString is not provided this value will be used to construct the "User ID=" part of the connection string. + + + + + Database password. If the ConnectionString is not provided this value will be used to construct the "Password=" part of the connection string. + + + + + Database name. If the ConnectionString is not provided this value will be used to construct the "Database=" part of the connection string. + + + + + Name of the connection string (as specified in <connectionStrings> configuration section. + + + + + Database host name. If the ConnectionString is not provided this value will be used to construct the "Server=" part of the connection string. + + + + + Indicates whether to keep the database connection open between the log events. + + + + + Name of the database provider. + + + + + Connection string. When provided, it overrides the values specified in DBHost, DBUserName, DBPassword, DBDatabase. + + + + + Connection string using for installation and uninstallation. If not provided, regular ConnectionString is being used. + + + + + Configures isolated transaction batch writing. If supported by the database, then it will improve insert performance. + + + + + Text of the SQL command to be run on each log level. + + + + + Type of the SQL command to be run on each log level. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Convert format of the property value + + + + + Culture used for parsing property string-value for type-conversion + + + + + Value to assign on the object-property + + + + + Name for the object-property + + + + + Type of the object-property + + + + + + + + + + + + + + Type of the command. + + + + + Connection string to run the command against. If not provided, connection string from the target is used. + + + + + Indicates whether to ignore failures. + + + + + Command text. + + + + + + + + + + + + + + + + + + + + + Database parameter name. + + + + + Layout used for rendering the database-parameter value. + + + + + Database parameter DbType. + + + + + Database parameter size. + + + + + Database parameter precision. + + + + + Database parameter scale. + + + + + Type of the parameter. + + + + + Fallback value when result value is not available + + + + + Convert format of the database parameter value. + + + + + Culture used for parsing parameter string-value for type-conversion + + + + + Whether empty value should translate into DbNull. Requires database column to allow NULL values. + + + + + Database parameter DbType (without reflection logic) + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + + Indicates whether to include call site (class and method name) in the T:NLog.LogEventInfo + + + + + Indicates whether to include source info (file name and line number) in the T:NLog.LogEventInfo + + + + + Option to include all properties from the log events + + + + + Indicates whether to include contents of the T:NLog.GlobalDiagnosticsContext dictionary + + + + + Whether to include the contents of the T:NLog.ScopeContext nested-state-stack. + + + + + Whether to include the contents of the T:NLog.ScopeContext properties-dictionary. + + + + + List of property names to exclude when P:NLog.Targets.TargetWithContext.IncludeEventProperties is true + + + + + Event Name for M:System.Diagnostics.DiagnosticSource.Write(System.String,System.Object) + + + + + Value for Event Payload Level-Property + + + + + Source Name for T:System.Diagnostics.DiagnosticSource + + + + + + + + + + + + + + + + Name of the property. + + + + + Layout used for rendering the property value. + + + + + Fallback value when result value is not available + + + + + Whether empty property value should be included in the output. + + + + + Type of the property. + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Layout that renders event Category. + + + + + Optional entry type. When not set, or when not convertible to T:System.Diagnostics.EventLogEntryType then determined by T:NLog.LogLevel + + + + + Layout that renders event ID. + + + + + Name of the Event Log to write to. This can be System, Application or any user-defined name. + + + + + Name of the machine on which Event Log service is running. + + + + + Maximum Event log size in kilobytes. + + + + + Message length limit to write to the Event Log. + + + + + Value to be used as the event Source. + + + + + Action to take if the message is larger than the P:NLog.Targets.EventLogTarget.MaxMessageLength option. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether to return to the first target after any successful write. + + + + + Whether to enable batching, but fallback will be handled individually + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Name of the file to write to. + + + + + Header. + + + + + Footer. + + + + + Size in bytes above which log files will be automatically archived. Zero or negative means disabled. + + + + + Indicates whether to trigger archive operation based on time-period, by moving active-file to file-path specified by P:NLog.Targets.FileTarget.ArchiveFileName + + + + + Legacy archive logic where file-archive-logic moves active file to path specified by P:NLog.Targets.FileTarget.ArchiveFileName, and then recreates the active file. Use P:NLog.Targets.FileTarget.ArchiveSuffixFormat to control suffix format, instead of now obsolete token {#} + + + + + Indicates whether any existing log-file should be archived on startup. + + + + + Format-string to convert archive sequence-number by using string.Format + + + + + Maximum days of archive files that should be kept. Zero or negative means disabled. + + + + + Maximum number of archive files that should be kept. Negative means disabled. + + + + + Indicates whether the footer should be written only when the file is archived. + + + + + Whether to write the Header on initial creation of file appender, even if the file is not empty. Default value is false, which means only write header when initial file is empty (Ex. ensures valid CSV files) + + + + + + File encoding. + + + + + Indicates whether to create directories if they do not exist. + + + + + Indicates whether to delete old log file on startup. + + + + + Indicates whether to enable log file(s) to be deleted. + + + + + Indicates whether to write BOM (byte order mark) in created files. + + + + + Whether or not this target should just discard all data that its asked to write. Mostly used for when testing NLog Stack except final write + + + + + Line ending mode. + + + + + Indicates whether to replace file contents on each write instead of appending log message at the end. + + + + + Maximum number of files to be kept open. + + + + + Indicates whether to automatically flush the file buffers after each log message. + + + + + Log file buffer size in bytes. + + + + + Maximum number of seconds that files are kept open. Zero or negative means disabled. + + + + + Maximum number of seconds before open files are flushed. Zero or negative means disabled. + + + + + Indicates whether to keep log file open instead of opening and closing it on each logging event. + + + + + + + + + + + + + + + + Name of the target. + + + + + Condition expression. Log events who meet this condition will be forwarded to the wrapped target. + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Indicates whether log text should be appended to the text of the control instead of overwriting it. + + + + + Name of control to which NLog will log write log text. + + + + + Name of the Form on which the control is located. + + + + + Whether new log entry are added to the start or the end of the control + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Password for the custom SSL certificate specified by P:NLog.Targets.NetworkTarget.SslCertificateFile + + + + + File path to custom SSL certificate for TCP Socket SSL connections + + + + + SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. + + + + + The number of seconds a TCP socket send-operation will block before timeout error. Default = 100 secs (0 = wait forever when network cable unplugged and tcp-buffer becomes full). + + + + + Action that should be taken if the message is larger than P:NLog.Targets.NetworkTarget.MaxMessageSize + + + + + Action that should be taken, when more connections than P:NLog.Targets.NetworkTarget.MaxConnections. + + + + + Action that should be taken, when more pending messages than P:NLog.Targets.NetworkTarget.MaxQueueSize. + + + + + Maximum simultaneous connections. Requires P:NLog.Targets.NetworkTarget.KeepConnection = false + + + + + Indicates whether to keep connection open whenever possible. + + + + + The number of seconds a connection will remain idle before the first keep-alive probe is sent + + + + + Size of the connection cache (number of connections which are kept alive). Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + Network destination address. + + + + + Maximum queue size for a single connection. Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + + Whether to disable the delayed ACK timer, and avoid delay of 200 ms. Default = true. + + + + + + + + + Type of compression for protocol payload. Useful for UDP where datagram max-size is 8192 bytes. + + + + + + + Skip compression when protocol payload is below limit to reduce overhead in cpu-usage and additional headers + + + + + + Maximum message size in bytes. On limit breach then P:NLog.Targets.NetworkTarget.OnOverflow action is activated. + + + + + Encoding to be used. + + + + + End of line value if a newline is appended at the end of log message P:NLog.Targets.NetworkTarget.NewLine. + + + + + Indicates whether to append newline at the end of log message. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Identifier to perform group-by + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Name of the file to write to. + + + + + Header. + + + + + Footer. + + + + + Whether to write the Header on initial creation of file appender, even if the file is not empty. Default value is false, which means only write header when initial file is empty (Ex. ensures valid CSV files) + + + + + Indicates whether the footer should be written only when the file is archived. + + + + + Maximum days of archive files that should be kept. Zero or negative means disabled. + + + + + Format-string to convert archive sequence-number by using string.Format + + + + + Maximum number of archive files that should be kept. Negative means disabled. + + + + + Legacy archive logic where file-archive-logic moves active file to path specified by P:NLog.Targets.FileTarget.ArchiveFileName, and then recreates the active file. Use P:NLog.Targets.FileTarget.ArchiveSuffixFormat to control suffix format, instead of now obsolete token {#} + + + + + Indicates whether to trigger archive operation based on time-period, by moving active-file to file-path specified by P:NLog.Targets.FileTarget.ArchiveFileName + + + + + Size in bytes above which log files will be automatically archived. Zero or negative means disabled. + + + + + Indicates whether any existing log-file should be archived on startup. + + + + + Whether to enable file-compression using T:System.IO.Compression.GZipStream + + + + + Whether to emphasize Fastest-speed or Optimal-compression + + + + + + Whether or not this target should just discard all data that its asked to write. Mostly used for when testing NLog Stack except final write + + + + + Indicates whether to write BOM (byte order mark) in created files. + + + + + Indicates whether to enable log file(s) to be deleted. + + + + + Indicates whether to delete old log file on startup. + + + + + Indicates whether to create directories if they do not exist. + + + + + File encoding. + + + + + Indicates whether to replace file contents on each write instead of appending log message at the end. + + + + + Line ending mode. + + + + + Maximum number of seconds that files are kept open. Zero or negative means disabled. + + + + + Log file buffer size in bytes. + + + + + Indicates whether to automatically flush the file buffers after each log message. + + + + + Indicates whether to keep log file open instead of opening and closing it on each logging event. + + + + + Maximum number of seconds before open files are flushed. Zero or negative means disabled. + + + + + Maximum number of files to be kept open. + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Windows domain name to change context to. + + + + + Required impersonation level. + + + + + Type of the logon provider. + + + + + Logon Type. + + + + + User account password. + + + + + Indicates whether to revert to the credentials of the process instead of impersonating another user. + + + + + Username to change context to. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Interval in which messages will be written up to the P:NLog.Targets.Wrappers.LimitingTargetWrapper.MessageLimit number of messages. + + + + + Maximum allowed number of messages written per P:NLog.Targets.Wrappers.LimitingTargetWrapper.Interval. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Separator for T:NLog.ScopeContext operation-states-stack. + + + + + Stack separator for log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Log4j:event logger-xml-attribute. Default: ${logger} + + + + + Whether to include the contents of the T:NLog.ScopeContext properties-dictionary. + + + + + Whether to include log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Indicates whether to include source info (file name and line number) in the information sent over the network. + + + + + Option to include all properties from the log events + + + + + Indicates whether to include call site (class and method name) in the information sent over the network. + + + + + Log4j:event message-xml-element. Default: ${message} + + + + + Log4j:event log4japp-xml-element. By default it's the friendly name of the current AppDomain. + + + + + Instance of T:NLog.Layouts.Log4JXmlEventLayout that is used to format log messages. + + + + + Whether to include log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Action that should be taken, when more pending messages than P:NLog.Targets.NetworkTarget.MaxQueueSize. + + + + + Password for the custom SSL certificate specified by P:NLog.Targets.NetworkTarget.SslCertificateFile + + + + + File path to custom SSL certificate for TCP Socket SSL connections + + + + + SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. + + + + + The number of seconds a TCP socket send-operation will block before timeout error. Default = 100 secs (0 = wait forever when network cable unplugged and tcp-buffer becomes full). + + + + + Action that should be taken if the message is larger than P:NLog.Targets.NetworkTarget.MaxMessageSize + + + + + The number of seconds a connection will remain idle before the first keep-alive probe is sent + + + + + Maximum queue size for a single connection. Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + Maximum simultaneous connections. Requires P:NLog.Targets.NetworkTarget.KeepConnection = false + + + + + Indicates whether to keep connection open whenever possible. + + + + + Size of the connection cache (number of connections which are kept alive). Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + Network destination address. + + + + + Action that should be taken, when more connections than P:NLog.Targets.NetworkTarget.MaxConnections. + + + + + Type of compression for protocol payload. Useful for UDP where datagram max-size is 8192 bytes. + + + + + Skip compression when protocol payload is below limit to reduce overhead in cpu-usage and additional headers + + + + + Whether to disable the delayed ACK timer, and avoid delay of 200 ms. Default = true. + + + + + Maximum message size in bytes. On limit breach then P:NLog.Targets.NetworkTarget.OnOverflow action is activated. + + + + + Encoding to be used. + + + + + End of line value if a newline is appended at the end of log message P:NLog.Targets.NetworkTarget.NewLine. + + + + + Indicates whether to append newline at the end of log message. + + + + + + + + + + + + + + Log4j:data property-name. + + + + + Layout used for rendering the log4j:data property-value. + + + + + Whether empty property-value should be included in the output. Default = false + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Endpoint address. + + + + + Name of the endpoint configuration in WCF configuration file. + + + + + Indicates whether to use a WCF service contract that is one way (fire and forget) or two way (request-reply) + + + + + Client ID. + + + + + Indicates whether to include per-event properties in the payload sent to the server. + + + + + Indicates whether to use binary message encoding. + + + + + + + + + + + + + + + Name of the parameter. + + + + + Layout used for rendering the method-parameter value. + + + + + Fallback value when result value is not available + + + + + Type of the parameter. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + Indicates whether NewLine characters in the body should be replaced with tags. + + + + + Priority used for sending mails. + + + + + Indicates whether to add new lines between log entries. + + + + + Encoding to be used for sending e-mail. + + + + + BCC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + Recipients' email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + Indicates whether to send message as HTML instead of plain text. + + + + + Sender's email address (e.g. joe@domain.com). + + + + + Mail message body (repeated for each log message send in one mail). + + + + + Mail subject. + + + + + CC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + + Provides a way of specifying the SSL and/or TLS encryption If P:NLog.MailKit.MailTarget.EnableSsl is true, then F:MailKit.Security.SecureSocketOptions.SslOnConnect will be used. + + + + + Get or set whether the client should use the REQUIRETLS extension if it is available. + + + + + Indicates the SMTP client timeout. + + + + + Folder where applications save mail messages to be processed by the local SMTP server. + + + + + SMTP Server to be used for sending. + + + + + Port number that SMTP Server is listening on. + + + + + Indicates whether SSL (secure sockets layer) should be used when communicating with SMTP server. + + + + + Password used to authenticate against SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + Username used to connect to SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + SMTP Authentication mode. + + + + + Indicates whether the default Settings from System.Net.MailSettings should be used. + + + + + Indicates whether SmtpClient should ignore invalid certificate. + + + + + Specifies how outgoing email messages will be handled. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + Max number of items to have in memory. Zero or Negative means no limit. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Message box title. + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Encoding to be used when writing text to the queue. + + + + + Indicates whether to use the XML format when serializing message. + + + + + Indicates whether to check if a queue exists before writing to it. + + + + + Indicates whether to create the queue if it doesn't exists. + + + + + Label to associate with each message. + + + + + Name of the queue to write to. + + + + + Indicates whether to use recoverable messages (with guaranteed delivery). + + + + + Indicates whether sending to a transactional queue using single-transaction-style. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Class name. + + + + + Method name. The method must be public and static. Use the AssemblyQualifiedName - https://learn.microsoft.com/dotnet/api/system.type.assemblyqualifiedname + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + + Indicates whether to include call site (class and method name) in the T:NLog.LogEventInfo + + + + + Indicates whether to include source info (file name and line number) in the T:NLog.LogEventInfo + + + + + Option to include all properties from the log events + + + + + Indicates whether to include contents of the T:NLog.GlobalDiagnosticsContext dictionary + + + + + Whether to include the contents of the T:NLog.ScopeContext nested-state-stack. + + + + + Whether to include the contents of the T:NLog.ScopeContext properties-dictionary. + + + + + List of property names to exclude when P:NLog.Targets.TargetWithContext.IncludeEventProperties is true + + + + + EventId forwarded to ILogger + + + + + EventId-Name forwarded to ILogger + + + + + Override name of ILogger, when target has been initialized with T:Microsoft.Extensions.Logging.ILoggerFactory + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Password for the custom SSL certificate specified by P:NLog.Targets.NetworkTarget.SslCertificateFile + + + + + File path to custom SSL certificate for TCP Socket SSL connections + + + + + SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. + + + + + The number of seconds a TCP socket send-operation will block before timeout error. Default = 100 secs (0 = wait forever when network cable unplugged and tcp-buffer becomes full). + + + + + Action that should be taken if the message is larger than P:NLog.Targets.NetworkTarget.MaxMessageSize + + + + + Action that should be taken, when more connections than P:NLog.Targets.NetworkTarget.MaxConnections. + + + + + Action that should be taken, when more pending messages than P:NLog.Targets.NetworkTarget.MaxQueueSize. + + + + + Maximum simultaneous connections. Requires P:NLog.Targets.NetworkTarget.KeepConnection = false + + + + + Indicates whether to keep connection open whenever possible. + + + + + The number of seconds a connection will remain idle before the first keep-alive probe is sent + + + + + Size of the connection cache (number of connections which are kept alive). Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + Network destination address. + + + + + Maximum queue size for a single connection. Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + Type of compression for protocol payload. Useful for UDP where datagram max-size is 8192 bytes. + + + + + Skip compression when protocol payload is below limit to reduce overhead in cpu-usage and additional headers + + + + + Whether to disable the delayed ACK timer, and avoid delay of 200 ms. Default = true. + + + + + Maximum message size in bytes. On limit breach then P:NLog.Targets.NetworkTarget.OnOverflow action is activated. + + + + + Encoding to be used. + + + + + End of line value if a newline is appended at the end of log message P:NLog.Targets.NetworkTarget.NewLine. + + + + + Indicates whether to append newline at the end of log message. + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Indicates whether to perform layout calculation. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether performance counter should be automatically created. + + + + + Name of the performance counter category. + + + + + Counter help text. + + + + + Name of the performance counter. + + + + + Performance counter type. + + + + + The value by which to increment the counter. + + + + + Performance counter instance name. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Default filter to be applied when no specific rule matches. + + + + + + + + + + + + + Condition to be tested. + + + + + Resulting filter to be applied when the condition matches. + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + + Name of the target. + + + + + Number of times to repeat each log message. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Whether to enable batching, and only apply single delay when a whole batch fails + + + + + Number of retries that should be attempted on the wrapped target in case of a failure. + + + + + Time to wait between retries in milliseconds. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Initial width of the form with rich text box. + + + + + Indicates whether the created window will be a tool window. + + + + + Indicates whether the created form will be initially minimized. + + + + + Maximum number of lines the rich text box will store (or 0 to disable this feature). + + + + + gets or sets the message retention strategy which determines how the target handles messages when there's no control attached, or when switching between controls + + + + + Name of the Form on which the control is located. If there is no open form of a specified name than NLog will create a new one. + + + + + Name of RichTextBox to which Nlog will write. + + + + + Indicates whether scroll bar will be moved automatically to show most recent log entries. + + + + + Indicates whether to create accessory form if the specified form/control combination was not found during target initialization. + + + + + Initial height of the form with rich text box. + + + + + Indicates whether to use default coloring rules. + + + + + Form created (true) or used an existing (false). Set after M:NLog.Windows.Forms.RichTextBoxTarget.InitializeTarget. Can be true only if P:NLog.Windows.Forms.RichTextBoxTarget.AllowAccessoryFormCreation is set to true (default). + + + + + If set to true, using "rtb-link" renderer (T:NLog.Windows.Forms.RichTextBoxLinkLayoutRenderer) would create clickable links in the control. E:NLog.Windows.Forms.RichTextBoxTarget.LinkClicked + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Background color. + + + + + Font color. + + + + + Font style of matched text. + + + + + Condition that must be met in order to set the specified font color. + + + + + + + + + + + + + + + + Background color. Names are identical with KnownColor enum extended with Empty value which means that background color won't be changed. + + + + + Font color. Names are identical with KnownColor enum extended with Empty value which means that font color won't be changed. + + + + + Font style of matched text. Possible values are the same as in FontStyle enum in System.Drawing. + + + + + Indicates whether to ignore case when comparing texts. + + + + + Regular expression to be matched. You must specify either text or regex. + + + + + Text to be matched. You must specify either text or regex. + + + + + Indicates whether to match whole words only. + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Password for the custom SSL certificate specified by P:NLog.Targets.NetworkTarget.SslCertificateFile + + + + + File path to custom SSL certificate for TCP Socket SSL connections + + + + + SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. + + + + + Action that should be taken, when more pending messages than P:NLog.Targets.NetworkTarget.MaxQueueSize. + + + + + Action that should be taken if the message is larger than P:NLog.Targets.NetworkTarget.MaxMessageSize + + + + + Action that should be taken, when more connections than P:NLog.Targets.NetworkTarget.MaxConnections. + + + + + The number of seconds a TCP socket send-operation will block before timeout error. Default = 100 secs (0 = wait forever when network cable unplugged and tcp-buffer becomes full). + + + + + Maximum simultaneous connections. Requires P:NLog.Targets.NetworkTarget.KeepConnection = false + + + + + Indicates whether to keep connection open whenever possible. + + + + + The number of seconds a connection will remain idle before the first keep-alive probe is sent + + + + + Size of the connection cache (number of connections which are kept alive). Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + Network destination address. + + + + + Maximum queue size for a single connection. Requires P:NLog.Targets.NetworkTarget.KeepConnection = true + + + + + + + + + + + + + + + + + Whether to disable the delayed ACK timer, and avoid delay of 200 ms. Default = true. + + + + + + Skip compression when protocol payload is below limit to reduce overhead in cpu-usage and additional headers + + + + + Type of compression for protocol payload. Useful for UDP where datagram max-size is 8192 bytes. + + + + + Maximum message size in bytes. On limit breach then P:NLog.Targets.NetworkTarget.OnOverflow action is activated. + + + + + Encoding to be used. + + + + + End of line value if a newline is appended at the end of log message P:NLog.Targets.NetworkTarget.NewLine. + + + + + Indicates whether to append newline at the end of log message. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Name of the Form on which the ToolStrip is located. + + + + + Name of the ToolStripItem to which NLog will log write log text. + + + + + Name of ToolStrip that contains the ToolStripItem to which NLog will log write log text. + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + + Forward F:NLog.LogLevel.Fatal to M:System.Diagnostics.Trace.Fail(System.String) (Instead of M:System.Diagnostics.Trace.TraceError(System.String)) + + + + + Force use M:System.Diagnostics.Trace.WriteLine(System.String) independent of T:NLog.LogLevel + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Encoding. + + + + + Should we include the BOM (Byte-order-mark) for UTF? Influences the P:NLog.Targets.WebServiceTarget.Encoding property. This will only work for UTF-8. + + + + + Web service method name. Only used with Soap. + + + + + Web service namespace. Only used with Soap. + + + + + Protocol to be used when calling web service. + + + + + Custom proxy address, include port separated by a colon + + + + + Proxy configuration when calling web service + + + + + Web service URL. + + + + + Value of the User-agent HTTP header. + + + + + Indicates whether to pre-authenticate the HttpWebRequest (Requires 'Authorization' in P:NLog.Targets.WebServiceTarget.Headers parameters) + + + + + Name of the root XML element, if POST of XML document chosen. If so, this property must not be null. (see P:NLog.Targets.WebServiceTarget.Protocol and F:NLog.Targets.WebServiceProtocol.XmlPost). + + + + + (optional) root namespace of the XML document, if POST of XML document chosen. (see P:NLog.Targets.WebServiceTarget.Protocol and F:NLog.Targets.WebServiceProtocol.XmlPost). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Custom column delimiter value (valid when P:NLog.Layouts.CsvLayout.Delimiter is set to F:NLog.Layouts.CsvColumnDelimiterMode.Custom). + + + + + Column delimiter. + + + + + Footer layout. + + + + + Header layout. + + + + + Body layout (can be repeated multiple times). + + + + + Quote Character. + + + + + Quoting mode. + + + + + Indicates whether CSV should include header. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the column. + + + + + Layout used for rendering the column value. + + + + + Override of Quoting mode + + + + + + + + + + + + + + + + + + + + + + Option to exclude null/empty properties from the log event (as JSON) + + + + + List of property names to exclude when P:NLog.Layouts.GelfLayout.IncludeEventProperties is true + + + + + Whether to activate the legacy Graylog Message Facility-field + + + + + Graylog Message Full-Message-field + + + + + Graylog Message Host-field + + + + + Graylog Message Short-Message-field + + + + + Option to include all properties from the log events + + + + + List of property names to include when P:NLog.Layouts.GelfLayout.IncludeEventProperties is true + + + + + Whether to include the contents of the T:NLog.ScopeContext properties-dictionary. + + + + + + + + + + + + + + + + Option to render the empty object value {} + + + + + Option to suppress the extra spaces in the output json. + + + + + + + + + + + + + + + + + + + + + + + Option to include all properties from the log event (as JSON) + + + + + Indicates whether to include contents of the T:NLog.GlobalDiagnosticsContext dictionary. + + + + + Whether to include the contents of the T:NLog.ScopeContext dictionary. + + + + + Option to exclude null/empty properties from the log event (as JSON) + + + + + List of property names to exclude when P:NLog.Layouts.JsonLayout.IncludeAllProperties is true + + + + + Auto indent and create new lines + + + + + How far should the JSON serializer follow object references before backing off + + + + + Option to render the empty object value {} + + + + + Option to suppress the extra spaces in the output json. + + + + + + + + + + + + + + + + + + Name of the attribute. + + + + + Layout used for rendering the attribute value. + + + + + Fallback value when result value is not available + + + + + Whether output should be encoded as Json-String-Property, or be treated as valid json. + + + + + Indicates whether to escape non-ascii characters + + + + + Whether empty attribute value should be included in the output. + + + + + Result value type, for conversion of layout rendering output + + + + + + + + + + + + + + Footer layout. + + + + + Header layout. + + + + + Body layout (can be repeated multiple times). + + + + + + + + + + + + + + + + + + + + + + + + + + + Option to include all properties from the log events + + + + + Whether to include log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Whether to include log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Whether to include the contents of the T:NLog.ScopeContext properties-dictionary. + + + + + Stack separator for log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Stack separator for log4j:NDC in output from T:NLog.ScopeContext nested context. + + + + + Whether the log4j:throwable xml-element should be written as CDATA + + + + + Log4j:event log4japp-xml-element. By default it's the friendly name of the current AppDomain. + + + + + Log4j:event message-xml-element. Default: ${message} + + + + + Indicates whether to include call site (class and method name) in the information sent over the network. + + + + + Indicates whether to include source info (file name and line number) in the information sent over the network. + + + + + Log4j:event logger-xml-attribute. Default: ${logger} + + + + + + + + + + + + + + + + + + + + + + + + + + Option to include all properties from the log event (as JSON) + + + + + Indicates whether to include contents of the T:NLog.GlobalDiagnosticsContext dictionary. + + + + + Whether to include the contents of the T:NLog.ScopeContext dictionary. + + + + + Option to exclude null/empty properties from the log event (as JSON) + + + + + List of property names to exclude when P:NLog.Layouts.JsonLayout.IncludeAllProperties is true + + + + + Auto indent and create new lines + + + + + How far should the JSON serializer follow object references before backing off + + + + + Option to render the empty object value {} + + + + + Option to suppress the extra spaces in the output json. + + + + + Whether to include "scopes"-section + + + + + Whether to include "Timestamp"-section + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Indicates whether LogEvent Properties should be included for StructuredData when P:NLog.Layouts.SyslogLayout.Rfc5424 = true + + + + + Indicates whether to use RFC 3164 for Syslog Format + + + + + Indicates whether to use RFC 5424 for Syslog Format + + + + + Prefix for StructuredData when P:NLog.Layouts.SyslogLayout.Rfc5424 = true + + + + + Name of the device / application / process sending the Syslog-message (Optional) + + + + + Device Facility + + + + + The FQDN or IPv4 address or IPv6 address or hostname of the sender machine (Optional) + + + + + Message Severity + + + + + Mesage Payload + + + + + The type of message that should be the same for events with the same semantics. Ex ${event-properties:EventId} (Optional) + + + + + Process Id or Process Name or Logger Name (Optional) + + + + + Indicates what DateTime format should be used when P:NLog.Layouts.SyslogLayout.Rfc5424 = true + + + + + + + + + + + + + + + + + + + Footer layout. + + + + + Header layout. + + + + + Body layout (can be repeated multiple times). + + + + + Newline to append after each directive header + + + + + + + + + + + + + Layout of the field. + + + + + Name of the field. + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the root XML element + + + + + Value inside the root XML element + + + + + Whether to include the contents of the T:NLog.ScopeContext dictionary. + + + + + List of property names to exclude when P:NLog.Layouts.XmlElementBase.IncludeEventProperties is true + + + + + Auto indent and create new lines + + + + + How far should the XML serializer follow object references before backing off + + + + + XML element name to use for rendering IList-collections items + + + + + XML attribute name to use when rendering property-key When null (or empty) then key-attribute is not included + + + + + XML element name to use when rendering properties + + + + + XML attribute name to use when rendering property-value When null (or empty) then value-attribute is not included and value is formatted as XML-element-value. + + + + + Determines whether or not this attribute will be Xml encoded. + + + + + Whether empty XML-element should be included in the output. + + + + + Option to include all properties from the log event (as XML) + + + + + + + + + + + + + + + + + Name of the attribute. + + + + + Layout used for rendering the attribute value. + + + + + Fallback value when result value is not available + + + + + Whether output should be encoded with Xml-string escaping, or be treated as valid xml-attribute-value + + + + + Whether empty attribute value should be included in the output. + + + + + Result value type, for conversion of layout rendering output + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the element + + + + + Whether to include the contents of the T:NLog.ScopeContext dictionary. + + + + + Layout used for rendering the XML-element InnerText. + + + + + Value inside the element + + + + + Whether output should be encoded with XML-string escaping, or be treated as valid xml-element-value + + + + + List of property names to exclude when P:NLog.Layouts.XmlElementBase.IncludeEventProperties is true + + + + + Auto indent and create new lines + + + + + How far should the XML serializer follow object references before backing off + + + + + XML element name to use for rendering IList-collections items + + + + + XML attribute name to use when rendering property-key When null (or empty) then key-attribute is not included + + + + + XML element name to use when rendering properties + + + + + XML attribute name to use when rendering property-value When null (or empty) then value-attribute is not included and value is formatted as XML-element-value. + + + + + Whether output should be wrapped using CDATA section instead of XML-string escaping + + + + + Whether empty XML-element should be included in the output. + + + + + Option to include all properties from the log event (as XML) + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Condition expression. + + + + + + + + + + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + Substring to be matched. + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + String to compare the layout to. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + Substring to be matched. + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + String to compare the layout to. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + + + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Append FilterCount to the P:NLog.LogEventInfo.Message when an event is no longer filtered + + + + + Insert FilterCount value into P:NLog.LogEventInfo.Properties when an event is no longer filtered + + + + + Applies the configured action to the initial logevent that starts the timeout period. Used to configure that it should ignore all events until timeout. + + + + + Layout to be used to filter log messages. + + + + + Max length of filter values, will truncate if above limit + + + + + How long before a filter expires, and logging is accepted again + + + + + Default number of unique filter values to expect, will automatically increase if needed + + + + + Max number of unique filter values to expect simultaneously + + + + + Default buffer size for the internal buffers + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BLWLogServer/Program.cs b/BLWLogServer/Program.cs new file mode 100644 index 0000000..83b86f2 --- /dev/null +++ b/BLWLogServer/Program.cs @@ -0,0 +1,49 @@ +using BLWLogServer.Services; +using MongoDB.Driver; + +namespace BLWLogServer +{ + public class Program + { + public static void Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + + // Add services to the container. + + builder.Services.AddControllers(); + + builder.Services.AddCors(options => + { + options.AddPolicy(name: "KuaYu", + policy => + { + policy + .AllowAnyOrigin() + .AllowAnyHeader() + .AllowAnyMethod(); + }); + }); + builder.Services.AddScoped(ppp => + { + string? connectionString = builder.Configuration["Mongodb:Connectstr"]; + //var connectionString = "mongodb://localhost:27017/"; + var client = new MongoClient(connectionString); + return client; + }); + builder.Services.AddHostedService(); + + var app = builder.Build(); + + // Configure the HTTP request pipeline. + + app.UseCors("KuaYu"); + app.UseAuthorization(); + + + app.MapControllers(); + + app.Run(); + } + } +} diff --git a/BLWLogServer/Properties/launchSettings.json b/BLWLogServer/Properties/launchSettings.json new file mode 100644 index 0000000..ca192a1 --- /dev/null +++ b/BLWLogServer/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52553", + "sslPort": 0 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "weatherforecast", + "applicationUrl": "http://localhost:5245", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "weatherforecast", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/BLWLogServer/Services/KafkaConsume.cs b/BLWLogServer/Services/KafkaConsume.cs new file mode 100644 index 0000000..95b4c13 --- /dev/null +++ b/BLWLogServer/Services/KafkaConsume.cs @@ -0,0 +1,469 @@ +using System.Text; +using Common; +using CommonEntity; +using CommonTools; +using Confluent.Kafka; +using MongoDB.Driver; +using NLog; +using System.Collections.Generic; + +namespace BLWLogServer.Services +{ + public class KafkaConsume : BackgroundService + { + public IConfiguration Configuration { get; set; } + public KafkaConsume(IConfiguration configuration) + { + Configuration = configuration; + } + + public static Logger logger = NLog.LogManager.GetCurrentClassLogger(); + + // 添加两个队列用于存储最近10条TotalCount + private static Queue _cpuMaxQueue = new(10); + private static Queue _cpuAvgQueue = new(10); + private static Queue _cpuMinQueue = new(10); + private static Queue _TotalSendPackage = new(10); + private static Queue _TotalRecvPackage = new(10); + private static Queue _RCUOnLine = new(10); + + protected async override Task ExecuteAsync(CancellationToken stoppingToken) + { + await Task.Factory.StartNew(async () => + { + var consumers = new List(); + for (int i = 0; i < 3; i++) + { + consumers.Add(Task.Run(() => StartConsumer(stoppingToken))); + } + await Task.WhenAll(consumers); + //await StartConsumer(stoppingToken); + }, TaskCreationOptions.LongRunning); + } + private async Task StartConsumer(CancellationToken stoppingToken) + { + string? ipport = Configuration["Kafka:EndPoint"]; + string? user = Configuration["Kafka:UserName"]; + string? pwd = Configuration["Kafka:PassWord"]; + string? mongodbconnectstr = Configuration["Mongodb:Connectstr"]; + while (!stoppingToken.IsCancellationRequested) + { + var config = new ConsumerConfig + { + GroupId = "blwlogserver-consumer-group", + AutoOffsetReset = AutoOffsetReset.Earliest, + BootstrapServers = ipport, + SecurityProtocol = SecurityProtocol.SaslPlaintext, + SaslMechanism = SaslMechanism.Plain, + SaslUsername = user, + SaslPassword = pwd + }; + + var c = new ConsumerBuilder(config).Build(); + c.Subscribe(KafkaKey.BLWLog_RCU_Topic); + + var connectionString = mongodbconnectstr; + var client = new MongoClient(connectionString); + try + { + while (true) + { + var cr = c.Consume(stoppingToken); + try + { + var k = cr.Message.Key; + var v = cr.Message.Value; + + if (k.Equals(KafkaKey.UDPPackageKey)) + { + //var UUU = Encoding.UTF8.GetString(v); + //Console.WriteLine($"Consumed message '{k} {v}' at: '{cr.TopicPartitionOffset}'."); + var collection = client.GetDatabase("udppackage").GetCollection("totalcount"); + UDPPackage UDPPPP = MyMessagePacker.FastDeserialize(v); + UDPPackage_db us = new UDPPackage_db(); + us.TotalCount = UDPPPP.TotalCount; + us.CommandType = UDPPPP.CommandType; + us.FenLei = UDPPPP.FenLei; + us.ExtraData = UDPPPP.ExtraData; + us.RemoveTimeString = UDPPPP.RemoveTime; + us.RemoveTime = DateTime.Parse(UDPPPP.RemoveTime); + await collection.InsertOneAsync(us); + // xu修改20250908 + // 修改CPUMax处理逻辑 + if (UDPPPP.CommandType == "UDPPackage_CPUMax") + { + // 维护队列长度不超过10 + if (_cpuMaxQueue.Count >= 10) + { + _cpuMaxQueue.Dequeue(); + } + _cpuMaxQueue.Enqueue(UDPPPP.TotalCount); + + // 将队列转为逗号分隔字符串 + string arrayString = string.Join(",", _cpuMaxQueue); + CSRedisCacheHelper.Set("UDPPackage_CPUMax", arrayString, 10); + } + + if (UDPPPP.CommandType == "UDPPackage_CPUMin") + { + // 维护队列长度不超过10 + if (_cpuMinQueue.Count >= 10) + { + _cpuMinQueue.Dequeue(); + } + _cpuMinQueue.Enqueue(UDPPPP.TotalCount); + + // 将队列转为逗号分隔字符串 + string arrayString = string.Join(",", _cpuMinQueue); + CSRedisCacheHelper.Set("UDPPackage_CPUMin", arrayString, 10); + } + // 修改CPUAvg处理逻辑 + if (UDPPPP.CommandType == "UDPPackage_CPUAvg") + { + // 维护队列长度不超过10 + if (_cpuAvgQueue.Count >= 10) + { + _cpuAvgQueue.Dequeue(); + } + _cpuAvgQueue.Enqueue(UDPPPP.TotalCount); + + // 将队列转为逗号分隔字符串 + string arrayString = string.Join(",", _cpuAvgQueue); + CSRedisCacheHelper.Set("UDPPackage_CPUAvg", arrayString, 10); + CSRedisCacheHelper.Set("UDPPackage_DetectTime", DateTime.UtcNow.ToString("o"), 10); + } + if (UDPPPP.CommandType == "UDPPackage_TotalSendPackage") + { + // 维护队列长度不超过10 + if (_TotalSendPackage.Count >= 10) + { + _TotalSendPackage.Dequeue(); + } + _TotalSendPackage.Enqueue(UDPPPP.TotalCount); + + // 将队列转为逗号分隔字符串 + string arrayString = string.Join(",", _TotalSendPackage); + CSRedisCacheHelper.Set("UDPPackage_TotalSendPackage", arrayString, 10); + } + if (UDPPPP.CommandType == "UDPPackage_TotalRecvPackage") + { + // 维护队列长度不超过10 + if (_TotalRecvPackage.Count >= 10) + { + _TotalRecvPackage.Dequeue(); + } + _TotalRecvPackage.Enqueue(UDPPPP.TotalCount); + + // 将队列转为逗号分隔字符串 + string arrayString = string.Join(",", _TotalRecvPackage); + CSRedisCacheHelper.Set("UDPPackage_TotalRecvPackage", arrayString, 10); + } + if (UDPPPP.CommandType == "RCUOnLine") + { + // 维护队列长度不超过10 + if (_RCUOnLine.Count >= 10) + { + _RCUOnLine.Dequeue(); + } + _RCUOnLine.Enqueue(UDPPPP.TotalCount); + + // 将队列转为逗号分隔字符串 + string arrayString = string.Join(",", _RCUOnLine); + CSRedisCacheHelper.Set("RCUOnLine", arrayString, 10); + } + } + else if (k.Equals(KafkaKey.UDPPackageStepMonitor)) + { + var collection = client.GetDatabase("udppackage").GetCollection("zeroe_stepmonitor"); + StepInfo UDPPPP = MyMessagePacker.FastDeserialize(v); + StepInfo_db us = new StepInfo_db(); + us.MessageId = UDPPPP.MessageId; + us.Step = UDPPPP.Step; + us.StepDescription = UDPPPP.StepDescription; + us.Content = UDPPPP.Content; + us.TriggerTime = DateTime.Parse(UDPPPP.TriggerTime); + us.TriggerTimeString = UDPPPP.TriggerTime; + us.EveryMessageId = UDPPPP.EveryMessageId; + us.Monitor_0E_01 = UDPPPP.Monitor_0E_01; + us.HostNumber = UDPPPP.HostNumber; + us.HotelCode = UDPPPP.HotelCode; + await collection.InsertOneAsync(us); + } + else if (k.Equals(KafkaKey.UDPPackagePowerMonitor)) + { + var collection = client.GetDatabase("udppackage").GetCollection("powermonitor"); + NengHao UDPPPP = MyMessagePacker.FastDeserialize(v); + NengHao_db us = new NengHao_db(); + us.Version = UDPPPP.Version; + us.HotelCode = UDPPPP.HotelCode; + us.HostNumber = UDPPPP.HostNumber; + us.Mac = UDPPPP.Mac; + us.EndPoint = UDPPPP.EndPoint; + us.V = UDPPPP.V; + us.A = UDPPPP.A; + us.P = UDPPPP.P; + us.Energy_Consumption = UDPPPP.Energy_Consumption; + us.Sum_Energy_Consumption = UDPPPP.Sum_Energy_Consumption; + us.IsTakeCard = UDPPPP.IsTakeCard; + us.CreateTime = UDPPPP.CreateTime; + us.ReportTime = DateTime.Parse(UDPPPP.ReportTime); + + us.RoomNumber = UDPPPP.RoomNumber; + us.CarbonVIP = UDPPPP.CarbonVIP; + us.AllDeviceData = UDPPPP.AllDeviceData; + us.IdentityInfo = UDPPPP.IdentityInfo; + await collection.InsertOneAsync(us); + } + + + else if (k.Equals(KafkaKey.IotMonitor)) + { + var collection = client.GetDatabase("udppackage").GetCollection("voiceiotlog"); + IOTMonitorData UDPPPP = MyMessagePacker.FastDeserialize(v); + IOTMonitorData_db us = new IOTMonitorData_db(); + us.Step = UDPPPP.Step; + us.TriggerTime = UDPPPP.TriggerTime; + us.HotelCode = UDPPPP.HotelCode; + us.HotelId = UDPPPP.HotelId; + us.HotelName = UDPPPP.HotelName; + us.RoomNumber = UDPPPP.RoomNumber; + us.RequestId = UDPPPP.RequestId; + us.CommandDescription = UDPPPP.CommandDescription; + us.Platform = UDPPPP.Platform; + us.CreateTime = UDPPPP.CreateTime; + us.RemoteIP = UDPPPP.RemoteIP; + us.ControlClass = UDPPPP.ControlClass; + us.SceneName = UDPPPP.SceneName; + us.WhichOneDevice = UDPPPP.WhichOneDevice; + + await collection.InsertOneAsync(us); + } + + // + else if (k.Equals(KafkaKey.RCUOnLineStatus)) + { + var collection = client.GetDatabase("udppackage").GetCollection("rcustatuslog"); + OnOffLineData UDPPPP = MyMessagePacker.FastDeserialize(v); + OnOffLineData_db us = new OnOffLineData_db(); + us.MAC = UDPPPP.MAC; + us.HostNumber = UDPPPP.HostNumber; + us.CurrentStatus = UDPPPP.CurrentStatus; + us.HotelCode = UDPPPP.HotelCode; + us.CurrentTime = UDPPPP.CurrentTime; + us.EndPoint = UDPPPP.EndPoint; + + await collection.InsertOneAsync(us); + } + + else if (k.Equals(KafkaKey.InvokceThirdHttpInterface)) + { + var collection = client.GetDatabase("udppackage").GetCollection("invokehttpinterfacelog"); + Interface3Log UDPPPP = MyMessagePacker.FastDeserialize(v); + + Interface3Log_db us = new Interface3Log_db(); + us.HotelCode = UDPPPP.HotelCode; + us.HostNumber = UDPPPP.HostNumber; + us.RoomNumber = UDPPPP.RoomNumber; + us.TriggerTime = UDPPPP.TriggerTime; + us.CommandType = UDPPPP.CommandType; + us.ActionData = UDPPPP.ActionData; + await collection.InsertOneAsync(us); + } + else if (k.Equals(KafkaKey.TakeCardStatus)) + { + var collection = client.GetDatabase("udppackage").GetCollection("takecardlog"); + MTakeCardData UDPPPP = MyMessagePacker.FastDeserialize(v); + MTakeCardData_db us = new MTakeCardData_db(); + us.Status = UDPPPP.Status; + us.HostNUMBER = UDPPPP.HostNUMBER; + us.LastUpdateTime = UDPPPP.LastUpdateTime; + us.HotelCode = UDPPPP.HotelCode; + us.Status = UDPPPP.Status; + await collection.InsertOneAsync(us); + } + else if (k.Equals(KafkaKey.ServiceInfoStatus)) + { + var collection = client.GetDatabase("udppackage").GetCollection("serviceinfolog"); + OtherServiceInfo UDPPPP = MyMessagePacker.FastDeserialize(v); + OtherServiceInfo_db us = new OtherServiceInfo_db(); + us.HotelCode = UDPPPP.HotelCode; + us.HostNumber = UDPPPP.HostNumber; + us.Address = UDPPPP.Address; + us.StatusReceiver = UDPPPP.StatusReceiver; + us.LastUpdateTime = UDPPPP.LastUpdateTime; + await collection.InsertOneAsync(us); + } + else if (k.Equals(KafkaKey.PMSLogMonitor)) + { + //Console.WriteLine("收到了 PMSData"); + var collection = client.GetDatabase("udppackage").GetCollection("pmslog"); + CheckInYuanShidata UDPPPP = MyMessagePacker.FastDeserialize(v); + CheckInYuanShidata_db us = new CheckInYuanShidata_db(); + us.Step = UDPPPP.Step; + us.IP = UDPPPP.IP; + us.RequestId = UDPPPP.RequestId; + us.CurrentTime = UDPPPP.CurrentTime; + us.CommandType = UDPPPP.CommandType; + us.JianJieData = UDPPPP.JianJieData; + us.ZhiJieData = UDPPPP.ZhiJieData; + await collection.InsertOneAsync(us); + } + + + #region 新版协议记录 + else if (k.Equals(KafkaKey.RCUNewVersion_Register)) + { + //P0~P3:子网掩码(4Byte) + //P4~P7:网关(4Byte) + //P8~P9:RCU端口(2Byte) + //P10~P15:Mac地址(6Byte) + //P16~P35:软件版本号(20Byte) + //P36~P38:配置版本号(3Byte) + //P39~P42:DNS服务器1 IP(4Byte) + //P43~P58:房型备注(16Byte) + //P59~P74:房号备注(16Byte) + //P75~P78:房型(4Byte) + //P79~P82:房号(4Byte) + + var collection = client.GetDatabase("udppackage").GetCollection("rcu_hexdata"); + NewVersionHexData UDPPPP = MyMessagePacker.FastDeserialize(v); + + //byte[] hexdata = Tools.GetBytesFromString(UDPPPP.HexData); + //var 子网掩码 = hexdata[0..4]; + //string subnet_mask = String.Join(".", 子网掩码);//子网掩码 + + //var 网关 = hexdata[4..8]; + //string gateway = string.Join(".", 网关); + + //var RCU端口 = hexdata[8..10]; + //int lan_port = BitConverter.ToInt32(RCU端口);//局域网端口 + + //var MAC = hexdata[10..16]; + //var 软件版本号 = hexdata[16..36]; + //var 配置版本 = hexdata[36..39]; + //var DNS服务器 = hexdata[39..43]; + //var 房型备注 = hexdata[43..59]; + //var 房号备注 = hexdata[59..75]; + //var 房型 = hexdata[75..79]; + //var 房号 = hexdata[79..83]; + + + //int ipType = reader.ReadByte();//IP类型 + //string type_number = Encoding.GetEncoding("GBK").GetString(reader.ReadBytes(16)).Replace(@"\u0000", "").Replace("", "").Trim();//机型编码 + //string lan_ip = String.Join(".", reader.ReadBytes(4));//局域网IP + //string server_ip = String.Join(".", reader.ReadBytes(4));//服务器IP + //string subnet_mask = String.Join(".", reader.ReadBytes(4));//子网掩码 + //string gateway = String.Join(".", reader.ReadBytes(4));//网关 + //int lan_port = BitConverter.ToInt32(reader.ReadBytes(4), 0);//局域网端口 + //string dns = String.Join(".", reader.ReadBytes(4));//DNS + //string software_version = Encoding.GetEncoding("GBK").GetString(reader.ReadBytes(20)).Replace(@"\u0000", "").Replace("", "").Trim();//软件版本号 + + NewVersionHexData_db cv = new NewVersionHexData_db(); + cv.HotelCode = UDPPPP.HotelCode; + cv.HostNumber = UDPPPP.HostNumber; + cv.RoomNumber = UDPPPP.RoomNumber; + cv.CurrentTime = UDPPPP.CurrentTime; + cv.RemoteEndPoint = UDPPPP.RemoteEndPoint; + cv.CmdType = UDPPPP.CmdType; + cv.HexData = UDPPPP.HexData; + cv.CurrentTime = UDPPPP.CurrentTime; + + await collection.InsertOneAsync(cv); + } + else if (k.Equals(KafkaKey.RCUNewVersion_RestartReason)) + { + + var collection = client.GetDatabase("udppackage").GetCollection("rcu_hexdata"); + NewVersionHexData UDPPPP = MyMessagePacker.FastDeserialize(v); + NewVersionHexData_db cv = new NewVersionHexData_db(); + cv.HotelCode = UDPPPP.HotelCode; + cv.HostNumber = UDPPPP.HostNumber; + cv.RoomNumber = UDPPPP.RoomNumber; + cv.CurrentTime = UDPPPP.CurrentTime; + cv.RemoteEndPoint = UDPPPP.RemoteEndPoint; + cv.CmdType = UDPPPP.CmdType; + cv.HexData = UDPPPP.HexData; + cv.CurrentTime = UDPPPP.CurrentTime; + + await collection.InsertOneAsync(cv); + } + else if (k.Equals(KafkaKey.RCUNewVersion_0E)) + { + + var collection = client.GetDatabase("udppackage").GetCollection("rcu_hexdata"); + NewVersionHexData UDPPPP = MyMessagePacker.FastDeserialize(v); + + + int length = 30 - 15 - 2; + using MemoryStream stream = new MemoryStream(null, 15, length); + + NewVersionHexData_db cv = new NewVersionHexData_db(); + cv.HotelCode = UDPPPP.HotelCode; + cv.HostNumber = UDPPPP.HostNumber; + cv.RoomNumber = UDPPPP.RoomNumber; + cv.CurrentTime = UDPPPP.CurrentTime; + cv.RemoteEndPoint = UDPPPP.RemoteEndPoint; + cv.CmdType = UDPPPP.CmdType; + cv.HexData = UDPPPP.HexData; + cv.CurrentTime = UDPPPP.CurrentTime; + + await collection.InsertOneAsync(cv); + } + else if (k.Equals(KafkaKey.RCUNewVersion_TakeCard)) + { + + var collection = client.GetDatabase("udppackage").GetCollection("rcu_hexdata"); + NewVersionHexData UDPPPP = MyMessagePacker.FastDeserialize(v); + NewVersionHexData_db cv = new NewVersionHexData_db(); + cv.HotelCode = UDPPPP.HotelCode; + cv.HostNumber = UDPPPP.HostNumber; + cv.RoomNumber = UDPPPP.RoomNumber; + cv.CurrentTime = UDPPPP.CurrentTime; + cv.RemoteEndPoint = UDPPPP.RemoteEndPoint; + cv.CmdType = UDPPPP.CmdType; + cv.HexData = UDPPPP.HexData; + cv.CurrentTime = UDPPPP.CurrentTime; + + await collection.InsertOneAsync(cv); + } + else if (k.Equals(KafkaKey.RCUNewTimerData)) + { + + } + else + { + + } + #endregion + + //Console.WriteLine($"消费者1收到消息: [分区{cr.Partition}] " + + // $"偏移量{cr.Offset}"); + //默认是开着的 + //c.Commit(cr); + } + catch (ConsumeException e) + { + logger.Error("出错:" + e.Message); + Console.WriteLine(111111111111111); + } + catch (Exception ex) + { + logger.Error("Ex出错:" + ex.Message); + Console.WriteLine(22222222222222); + } + } + } + catch (OperationCanceledException) + { + logger.Error("操作出错"); + Console.WriteLine("操作错误"); + } + catch (Exception ex) + { + Console.WriteLine("未知错误" + ex.Message); + logger.Error("未知错误" + ex.Message); + } + } + } + } +} \ No newline at end of file diff --git a/BLWLogServer/Services/KafkaConsume1.cs b/BLWLogServer/Services/KafkaConsume1.cs new file mode 100644 index 0000000..ac8cbcc --- /dev/null +++ b/BLWLogServer/Services/KafkaConsume1.cs @@ -0,0 +1,154 @@ +using System.Text; +using Common; +using CommonEntity; +using CommonTools; +using Confluent.Kafka; +using MongoDB.Driver; +using NLog; +using System.Collections.Generic; +using Confluent.Kafka.Admin; +using static Confluent.Kafka.ConfigPropertyNames; +using System.Configuration; + +namespace BLWLogServer.Services +{ + public class KafkaConsume1 : BackgroundService + { + public IConfiguration Configuration { get; set; } + public KafkaConsume1(IConfiguration configuration) + { + Configuration = configuration; + } + + public static Logger logger = NLog.LogManager.GetCurrentClassLogger(); + + private async Task StartConsumer(CancellationToken stoppingToken) + { + string? ipport = Configuration["Kafka:EndPoint"]; + string? user = Configuration["Kafka:UserName"]; + string? pwd = Configuration["Kafka:PassWord"]; + string? mongodbconnectstr = Configuration["Mongodb:Connectstr"]; + + + while (!stoppingToken.IsCancellationRequested) + { + var conf = new ConsumerConfig + { + GroupId = "blwlogserver-consumer-group", + AutoOffsetReset = AutoOffsetReset.Earliest, + BootstrapServers = ipport, + SecurityProtocol = SecurityProtocol.SaslPlaintext, + SaslMechanism = SaslMechanism.Plain, + EnableAutoCommit = true, + SaslUsername = user, + SaslPassword = pwd + + }; + + + var c = new ConsumerBuilder(conf) + .SetErrorHandler((_, e) => + { + logger.Error($"消费者错误: {e.Reason}"); + }).SetPartitionsAssignedHandler((c, partitions) => + { + logger.Error($"消费者分配到分区: {string.Join(", ", partitions)}"); + }).Build(); + + //c.Subscribe(KafkaKey.BLWLog_RCU_Topic_Partition); + c.Subscribe(KafkaKey.BLWLog_RCU_Topic); + var connectionString = mongodbconnectstr; + var client = new MongoClient(connectionString); + try + { + while (true) + { + var consumeResult = c.Consume(stoppingToken); + try + { + var k = consumeResult.Message.Key; + var v = consumeResult.Message.Value; + + if (k.Equals("testtest")) + { + Console.WriteLine("11111111111111111111"); + } + if (k.Equals(KafkaKey.InvokceThirdHttpInterface)) + { + var collection = client.GetDatabase("udppackage").GetCollection("invokehttpinterfacelog"); + Interface3Log UDPPPP = MyMessagePacker.FastDeserialize(v); + + Interface3Log_db us = new Interface3Log_db(); + us.HotelCode = UDPPPP.HotelCode; + us.HostNumber = UDPPPP.HostNumber; + us.RoomNumber = UDPPPP.RoomNumber; + us.TriggerTime = UDPPPP.TriggerTime; + us.ActionData = UDPPPP.ActionData; + await collection.InsertOneAsync(us); + } + else if (k.Equals(KafkaKey.TakeCardStatus)) + { + var collection = client.GetDatabase("udppackage").GetCollection("takecardlog"); + MTakeCardData UDPPPP = MyMessagePacker.FastDeserialize(v); + MTakeCardData_db us = new MTakeCardData_db(); + us.Status = UDPPPP.Status; + us.HostNUMBER = UDPPPP.HostNUMBER; + us.LastUpdateTime = UDPPPP.LastUpdateTime; + us.HotelCode = UDPPPP.HotelCode; + us.Status = UDPPPP.Status; + await collection.InsertOneAsync(us); + } + else if (k.Equals(KafkaKey.ServiceInfoStatus)) + { + var collection = client.GetDatabase("udppackage").GetCollection("serviceinfolog"); + OtherServiceInfo UDPPPP = MyMessagePacker.FastDeserialize(v); + OtherServiceInfo_db us = new OtherServiceInfo_db(); + us.HotelCode = UDPPPP.HotelCode; + us.HostNumber = UDPPPP.HostNumber; + us.Address = UDPPPP.Address; + us.StatusReceiver = UDPPPP.StatusReceiver; + us.LastUpdateTime = UDPPPP.LastUpdateTime; + await collection.InsertOneAsync(us); + } + else + { + Console.WriteLine( "11111111111111111"); + } + if (consumeResult.IsPartitionEOF) + { + Console.WriteLine($"消费者1到达分区末尾: {consumeResult.TopicPartitionOffset}"); + } + + //Console.WriteLine($"消费者1收到消息: [分区{consumeResult.Partition}] " + + // $"偏移量{consumeResult.Offset}: {consumeResult.Message.Value}"); + // 手动提交偏移量 + //c.Commit(consumeResult); + } + catch (ConsumeException e) + { + logger.Error(e.Message); + } + } + } + catch (OperationCanceledException) + { + c.Close(); + } + } + } + protected async override Task ExecuteAsync(CancellationToken stoppingToken) + { + await Task.Factory.StartNew(async () => + { + var consumers = new List(); + for (int i = 0; i < 2; i++) + { + consumers.Add(Task.Run(() => StartConsumer(stoppingToken))); + } + + await Task.WhenAll(consumers); + }, TaskCreationOptions.LongRunning); + await Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/BLWLogServer/Services/S.cs b/BLWLogServer/Services/S.cs new file mode 100644 index 0000000..c90ab38 --- /dev/null +++ b/BLWLogServer/Services/S.cs @@ -0,0 +1,246 @@ +using System.Collections.Concurrent; + +namespace BLWLogServer.Services +{ + public class Device + { + /// + /// 设备地址 + /// + public string Address { get; set; } + /// + /// 地址类型 + /// + //public AddressType AddressType { get; set; } + /// + /// 设备开关状态:1开,2关,6停(窗帘),下发1个字节 + /// + public byte Status { get; set; } + /// + /// 设备开关状态:1开,2关,6停(窗帘),接收2个字节 + /// + public ushort StatusReceiver { get; set; } + /// + /// 亮度值 + /// + public byte Brightness { get; set; } + /// + /// 温度 + /// + public byte Temperature { get; set; } + /// + /// 风速 + /// + public byte FanSpeed { get; set; } + /// + /// 模式 + /// + public byte Mode { get; set; } + /// + /// 阀门开关 + /// + public byte Valve { get; set; } + /// + /// 空调执行方式和内容 + /// + public Int32 AirExecMode { get; set; } + /// + /// 地暖执行方式和内容 + /// + public Int32 FloorHotExecMode { get; set; } + /// + /// 背景音乐执行方式和内容 + /// + public Int32 MusicExecMode { get; set; } + /// + /// 色温执行方式和内容 + /// + //public Int32 ColorTempExecMode { get; set; } + } + public class Status + { + /// + /// RCU是否锁定 + /// + public bool SysLock { get; set; } + /// + /// 房卡类型 + /// + public byte CardType { get; set; } + /// + /// 房门开关 + /// + public bool Door { get; set; } + /// + /// 电量 + /// + public ushort ElecQty { get; set; } + /// + /// 主机温度 + /// + public byte HostTemp { get; set; } + /// + /// 空调状态 + /// + public ConcurrentDictionary AirConditions = new ConcurrentDictionary(); + /// + /// 设备状态 + /// + public ConcurrentDictionary Devices = new ConcurrentDictionary(); + /// + /// 故障列表 + /// + public ConcurrentDictionary Faults = new ConcurrentDictionary(); + } + + /// + /// 空调状态 + /// + public class AirConditionStatus + { + /// + /// 空调号 + /// + public byte AirNo { get; set; } + /// + /// 当前温度 + /// + public int CurrentTemp { get; set; } + /// + /// 设定温度 + /// + public int SettingTemp { get; set; } + /// + /// 风机开关 + /// + public bool OnOff { get; set; } + /// + /// 风速:0/停止, 1/低速, 2/中速, 3/高速, 4/自动 + /// + public int Speed { get; set; } + /// + /// 模式: 0/制冷,1/制热,2/送风,3/除湿 + /// + public int Mode { get; set; } + /// + /// 阀状态: 1/阀开,2/阀关 + /// + public int Valve { get; set; } + /// + /// 补偿温度,范围-6.0~6.0 + /// + public float CompensatoryTemp { get; set; } + /// + /// 保温温度 + /// + public int KeepTemp { get; set; } + /// + /// 冷热模式:0/手动,1/自动 + /// + public int ColdHotMode { get; set; } + /// + /// 死区温度 + /// + public int DeadTemp { get; set; } + /// + /// 热偏差 + /// + public int HotDevition { get; set; } + /// + /// 冷偏差 + /// + public int ColdDevition { get; set; } + } + + public class FaultStaus + { + /// + /// 故障号 + /// + public string FaultNo { get; set; } + /// + /// 类型:1在线状态(0在线,1离线),2电量(0~100%),3电流,4 1901故障检测次数,5设备单个回路状态(0正常,1损坏) + /// + public byte Type { get; set; } + /// + /// 内容 + /// + public byte Data { get; set; } + } + public class S + { + public static Status NewStatusParse(Stream stream) + { + Status roomStatus = new Status(); + try + { + using (BinaryReader reader = new BinaryReader(stream)) + { + roomStatus.SysLock = reader.ReadBoolean(); //RCU是否锁定:0/否,1/是 + roomStatus.CardType = reader.ReadByte(); //房卡类型:0/无人,1/有人,2/客人,3/经理,4/服务员 + roomStatus.Door = reader.ReadBoolean(); //门磁开关:1/开,2/关 + roomStatus.ElecQty = reader.ReadUInt16(); //门锁电量,单位:MV + roomStatus.HostTemp = reader.ReadByte(); //主机温度 + //空调数量,默认0,新的回路方式,此处无用,兼容老版本 + int airConditionNumber = reader.ReadByte(); + for (int i = 0; i < airConditionNumber; i++) + { + byte airNo = reader.ReadByte(); + if (!roomStatus.AirConditions.ContainsKey(airNo)) + { + roomStatus.AirConditions[airNo] = new AirConditionStatus(); + } + roomStatus.AirConditions[airNo].AirNo = airNo; + roomStatus.AirConditions[airNo].CurrentTemp = reader.ReadSByte(); + roomStatus.AirConditions[airNo].SettingTemp = reader.ReadSByte(); + roomStatus.AirConditions[airNo].OnOff = reader.ReadBoolean(); + roomStatus.AirConditions[airNo].Speed = reader.ReadByte(); + roomStatus.AirConditions[airNo].Mode = reader.ReadByte(); + roomStatus.AirConditions[airNo].Valve = reader.ReadByte(); + roomStatus.AirConditions[airNo].CompensatoryTemp = reader.ReadByte(); + roomStatus.AirConditions[airNo].KeepTemp = reader.ReadByte(); + roomStatus.AirConditions[airNo].ColdHotMode = reader.ReadByte(); + roomStatus.AirConditions[airNo].DeadTemp = reader.ReadByte(); + roomStatus.AirConditions[airNo].HotDevition = reader.ReadByte(); + roomStatus.AirConditions[airNo].ColdDevition = reader.ReadByte(); + } + //设备状态数量,包含所有回路状态 + int deviceNumber = reader.ReadByte(); + + long originalPosition = reader.BaseStream.Position; + // 读取前先记录当前位置 + try + { + //0x19数据缓冲区异常问题处理 + //0x19 取电数据不处理 + //非0x19 取电数据处理,但是不触发 欢迎词 + for (int i = 0; i < deviceNumber; i++) + { + var QA = reader.ReadBytes(4); + var Status = reader.ReadUInt16(); + + string address = String.Format("{0:000}{1:000}{2:000}", QA[0], QA[1], QA[0]); + if (!roomStatus.Devices.ContainsKey(address)) + { + roomStatus.Devices[address] = new Device(); + } + roomStatus.Devices[address].Address = address;//设备地址 + roomStatus.Devices[address].StatusReceiver = Status;//设备状态改为2个字节,Modified By 20181213 + originalPosition = reader.BaseStream.Position; + } + } + catch (Exception) + { + // 发生异常时回退到原始位置 + reader.BaseStream.Position = originalPosition; + } + return roomStatus; + } + } + catch (Exception) + { + return null; + } + } + } +} diff --git a/BLWLogServer/WeatherForecast.cs b/BLWLogServer/WeatherForecast.cs new file mode 100644 index 0000000..7ee699e --- /dev/null +++ b/BLWLogServer/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace BLWLogServer +{ + public class WeatherForecast + { + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} diff --git a/BLWLogServer/appsettings.Development.json b/BLWLogServer/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/BLWLogServer/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/BLWLogServer/appsettings.json b/BLWLogServer/appsettings.json new file mode 100644 index 0000000..9e8aa43 --- /dev/null +++ b/BLWLogServer/appsettings.json @@ -0,0 +1,20 @@ +{ + "Mongodb": { + "Connectstr": "mongodb://blv-rd-admin:A*%26(y*DG%26v(AS%26Di7gct@10.8.8.210:27017/" + }, + "Kafka": { + "EndPoint": "43.138.217.154:9092", + "UserName": "blwmomo", + "PassWord": "blwmomo" + //"EndPoint": "172.16.4.132:9092", + //"UserName": "blwmomo", + //"PassWord": "blwmomo" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/BLWLogServer/nlog.config b/BLWLogServer/nlog.config new file mode 100644 index 0000000..3a1832e --- /dev/null +++ b/BLWLogServer/nlog.config @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ClassLibrary1/B.cs b/ClassLibrary1/B.cs new file mode 100644 index 0000000..a669a87 --- /dev/null +++ b/ClassLibrary1/B.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ClassLibrary1 +{ + internal class B + { + } +} diff --git a/ClassLibrary1/C.cs b/ClassLibrary1/C.cs new file mode 100644 index 0000000..3de1260 --- /dev/null +++ b/ClassLibrary1/C.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ClassLibrary1 +{ + internal class C + { + } +} diff --git a/ClassLibrary1/Class1.cs b/ClassLibrary1/Class1.cs new file mode 100644 index 0000000..ca3cd76 --- /dev/null +++ b/ClassLibrary1/Class1.cs @@ -0,0 +1,7 @@ +namespace ClassLibrary1 +{ + public class Class1 + { + + } +} diff --git a/ClassLibrary1/ClassLibrary1.csproj b/ClassLibrary1/ClassLibrary1.csproj new file mode 100644 index 0000000..4e79377 --- /dev/null +++ b/ClassLibrary1/ClassLibrary1.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + diff --git a/ClassLibrary2/Class1.cs b/ClassLibrary2/Class1.cs new file mode 100644 index 0000000..7d524f2 --- /dev/null +++ b/ClassLibrary2/Class1.cs @@ -0,0 +1,21 @@ +using MemoryPack; + +namespace ClassLibrary2 +{ + [MemoryPackable] + public partial class MMN + { + public string Name { get; set; } + public int Age { get; set; } + public string Description { get; set; } + public void SayHello() + { + Console.WriteLine("1111111111111111"); + } + + public int Add(int a, int b) + { + return a + b; + } + } +} diff --git a/ClassLibrary2/ClassLibrary2.csproj b/ClassLibrary2/ClassLibrary2.csproj new file mode 100644 index 0000000..9ec3f2a --- /dev/null +++ b/ClassLibrary2/ClassLibrary2.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/ClassLibrary3/Class1.cs b/ClassLibrary3/Class1.cs new file mode 100644 index 0000000..55b3cfd --- /dev/null +++ b/ClassLibrary3/Class1.cs @@ -0,0 +1,10 @@ +namespace ClassLibrary3 +{ + public class Class1 + { + public void FFF() + { + Console.WriteLine("aaaaaaaaaaaaaaaa"); + } + } +} diff --git a/ClassLibrary3/ClassLibrary3.csproj b/ClassLibrary3/ClassLibrary3.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/ClassLibrary3/ClassLibrary3.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/CommonEntity/CommonEntity.csproj b/CommonEntity/CommonEntity.csproj new file mode 100644 index 0000000..c51d54e --- /dev/null +++ b/CommonEntity/CommonEntity.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/CommonEntity/DeviceType.cs b/CommonEntity/DeviceType.cs new file mode 100644 index 0000000..1faf576 --- /dev/null +++ b/CommonEntity/DeviceType.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CommonEntity +{ + public enum DeviceType + { + /// + /// 主机继电器 + /// + [Description("主机继电器")] + Relay = 1, + /// + /// 弱电输出 + /// + [Description("弱电输出")] + LVout = 3, + /// + /// 服务信息 + /// + [Description("服务信息")] + ServiceInfo = 4, + /// + /// 窗帘 + /// + [Description("窗帘")] + Curtain = 5, + /// + /// 开关扩展 + /// + [Description("开关扩展")] + SwitchExpand = 6, + /// + /// 空调 + /// + [Description("空调")] + AirConditioner = 7, + /// + /// 红外感应 + /// + [Description("红外感应")] + InFrared = 8, + /// + /// 空气质量检测 + /// + [Description("空气质量检测")] + AirDetect = 9, + /// + /// 插卡取电 + /// + [Description("插卡取电")] + CardPower = 10, + /// + /// 地暖 + /// + [Description("地暖")] + FloorHot = 11, + /// + /// 扩展继电器 + /// + [Description("扩展继电器")] + Expand = 14, + /// + /// 电视 + /// + [Description("电视")] + TV = 15, + /// + /// LED调光 + /// + [Description("LED调光")] + Dimmer = 16, + /// + /// 可控硅调光 + /// + [Description("可控硅调光")] + Traic = 17, + /// + /// 灯带调光 + /// + [Description("灯带调光")] + Strip = 18, + /// + /// PWM调光 + /// + [Description("PWM调光")] + PWMDimmer = 23, + /// + /// PWM扩展 + /// + [Description("PWM扩展")] + PWMExpand = 24, + /// + /// 音乐 + /// + [Description("音乐")] + Music = 21, + /// + /// 微信锁 + /// + [Description("微信锁")] + WXLock = 20, + /// + /// PB LED + /// + [Description("PB LED")] + PBLED = 25, + /// + /// 485A9IO继电器 + /// + [Description("485A9IO继电器")] + A9IORelay = 28, + /// + /// PB20 + /// + [Description("PB20")] + PB20 = 30, + /// + /// PB20-LD + /// + [Description("PB20-LD")] + PB20_LD = 31, + /// + /// PB20-LS + /// + [Description("PB20-LS")] + PB20_LS = 32, + /// + /// PB20-RELAY + /// + [Description("PB20-RELAY")] + PB20_RELAY = 33, + /// + /// 色温 + /// + [Description("色温")] + ColorTemp = 34, + + /// + /// 地址是054000001 + /// + [Description("碳达人")] + CarbonVIP = 54, + + //窗帘地址是:013001000 + [Description("485窗帘")] + Curtain485 = 100 + } +} diff --git a/CommonEntity/ForkSystem.cs b/CommonEntity/ForkSystem.cs new file mode 100644 index 0000000..86276c0 --- /dev/null +++ b/CommonEntity/ForkSystem.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MessagePack; + +namespace CommonEntity +{ + [MessagePackObject] + public class ForkSystem + { + [Key(0)] + public string? EndPoint { get; set; } + [Key(1)] + public byte[] Data { get; set; } + [Key(2)] + public DateTime CurrentTime { get; set; } + } + + + +} diff --git a/CommonEntity/Iot.cs b/CommonEntity/Iot.cs new file mode 100644 index 0000000..9e9e47b --- /dev/null +++ b/CommonEntity/Iot.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MessagePack; +using MongoDB.Bson; + +namespace CommonEntity +{ + [MessagePackObject()] + public class IOTMonitorData + { + [Key(0)] + public double Step { get; set; } + + [Key(1)] + public string? RequestId { get; set; } + + [Key(2)] + public string? Platform { get; set; } + + + [Key(3)] + public string? TriggerTime { get; set; } + + + [Key(4)] + public string? HotelId { get; set; } + + + [Key(5)] + public int HotelCode { get; set; } + + + [Key(6)] + public string? HotelName { get; set; } + + + [Key(7)] + public string RoomNumber { get; set; } + + [Key(8)] + + public string CommandDescription { get; set; } + + + [Key(9)] + public DateTime CreateTime { get; set; } + + + [Key(10)] + public string? RemoteIP { get; set; } + + [Key(11)] + public string? ControlClass { get; set; } + + [Key(12)] + public string? SceneName { get; set; } + + [Key(13)] + public List? WhichOneDevice { get; set; } + } + + [MessagePackObject()] + public class IotDeviceData + { + [Key(0)] + public string? DeviceName { get; set; } + + [Key(1)] + public string? DeviceAddress { get; set; } + } + [MessagePackObject()] + public class OnOffLineData + { + [Key(0)] + public string? HotelCode { get; set; } + + [Key(1)] + public string? MAC { get; set; } + + [Key(2)] + public string? HostNumber { get; set; } + + [Key(3)] + public string? EndPoint { get; set; } + + [Key(4)] + public string? CurrentStatus { get; set; } + + [Key(5)] + public DateTime CurrentTime { get; set; } + } + + + [MessagePackObject()] + public class MTakeCardData + { + [Key(0)] + public string? HostNUMBER { get; set; } + + [Key(1)] + public string? HotelCode { get; set; } + + [Key(2)] + public byte Status { get; set; } + + [Key(3)] + public DateTime LastUpdateTime { get; set; } + } + + + public class IOTMonitorData_db + { + public ObjectId _id { get; set; } + public double Step { get; set; } + + public string? RequestId { get; set; } + public string? Platform { get; set; } + + public string? TriggerTime { get; set; } + + public string? HotelId { get; set; } + public int HotelCode { get; set; } + public string? HotelName { get; set; } + public string? RoomNumber { get; set; } + + public string? CommandDescription { get; set; } + + public DateTime CreateTime { get; set; } + + + public string? RemoteIP { get; set; } + public string? ControlClass { get; set; } + + public string? SceneName { get; set; } + public List? WhichOneDevice { get; set; } + } + + public class DevMonitorIOTLogResult_WITH_Count + { + public int TotalCount { get; set; } + public int RequestIdCount { get; set; } + + public int RequestNotContainerCount { get; set; } + public List? devMonitorLogResults { get; set; } + } + + + public class MTakeCardData_db + { + + public ObjectId _id { get; set; } + public string? HostNUMBER { get; set; } + public string? HotelCode { get; set; } + public byte Status { get; set; } + public DateTime LastUpdateTime { get; set; } + } + public class OnOffLineData_db + { + public ObjectId _id { get; set; } + public string? HotelCode { get; set; } + public string? MAC { get; set; } + public string? HostNumber { get; set; } + public string? EndPoint { get; set; } + public string? CurrentStatus { get; set; } + public DateTime CurrentTime { get; set; } + } +} diff --git a/CommonEntity/LogBase.cs b/CommonEntity/LogBase.cs new file mode 100644 index 0000000..8045bda --- /dev/null +++ b/CommonEntity/LogBase.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MongoDB.Bson; +using static System.Runtime.InteropServices.JavaScript.JSType; + +namespace CommonEntity +{ + public class LogBase + { + public ObjectId _id { get; set; } + public string? MessageId { get; set; } + + public string HotelCode { get; set; } + public string RoomNum { get; set; } + + public string MessageType { get; set; } + + public DataContext Context { get; set; } + + public DateTime CreateDateTime { get; set; } + } + public class DataContext + { + public string Data { get; set; } + public int Age { get; set; } + } +} diff --git a/CommonEntity/LogQuery.cs b/CommonEntity/LogQuery.cs new file mode 100644 index 0000000..b03ab7a --- /dev/null +++ b/CommonEntity/LogQuery.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CommonEntity +{ + public class LogQuery + { + public List Data { get; set; } + + /// + /// 时间片 + /// + public string? Start_Time { get; set; } + public string? End_Time { get; set; } + + public string? Start_Time_Really { get; set; } + public string? End_Time_Really { get; set; } + public bool IsQuery_Really { get; set; } + public int PageSize { get; set; } + public int PageIndex { get; set; } + public List CommandType { get; set; } + } + public class QueryData + { + public string? HotelCode { get; set; } + public string? Key_HostNumber { get; set; } + + public string? RoomNumber { get; set; } + public string? MAC { get; set; } + + } +} diff --git a/CommonEntity/NewVersionHexData.cs b/CommonEntity/NewVersionHexData.cs new file mode 100644 index 0000000..653efc3 --- /dev/null +++ b/CommonEntity/NewVersionHexData.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MessagePack; +using MongoDB.Bson; + +namespace CommonEntity +{ + [MessagePackObject()] + public class NewVersionHexData + { + [Key(0)] + public byte CmdType { get; set; } + + [Key(1)] + public string? HotelCode { get; set; } + + [Key(2)] + public string? HostNumber { get; set; } + + [Key(3)] + public string? RoomNumber { get; set; } + + [Key(4)] + public string? RemoteEndPoint { get; set; } + + [Key(5)] + public string? HexData { get; set; } + + [Key(6)] + public DateTime CurrentTime { get; set; } + } + + + public class NewVersionHexData_db + { + public ObjectId _id { get; set; } + public byte CmdType { get; set; } + public string? HotelCode { get; set; } + public string? HostNumber { get; set; } + public string? RoomNumber { get; set; } + public string? RemoteEndPoint { get; set; } + public string? HexData { get; set; } + public DateTime CurrentTime { get; set; } + public List>? Data { get; set; } + } +} diff --git a/CommonEntity/PMSData.cs b/CommonEntity/PMSData.cs new file mode 100644 index 0000000..8041f58 --- /dev/null +++ b/CommonEntity/PMSData.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MessagePack; +using MongoDB.Bson; + +namespace CommonEntity +{ + public class PMSData + { + } + + + public class CheckInYuanShidata_db: CheckInYuanShidata + { + public ObjectId _id { get; set; } + } + + [MessagePackObject()] + public class CheckInYuanShidata + { + [Key(0)] + public string? CommandType { get; set; } + + [Key(1)] + public double Step { get; set; } + + [Key(2)] + public string? IP { get; set; } + + [Key(3)] + public string? RequestId { get; set; } + + [Key(4)] + public ZhiJie? ZhiJieData { get; set; } + + [Key(5)] + public JianJie? JianJieData { get; set; } + + [Key(6)] + public DateTime CurrentTime { get; set; } + } + + [MessagePackObject()] + public class ZhiJie + { + [Key(0)] + public CheckInData? CheckInData { get; set; } + + [Key(1)] + public CheckOutData? CheckOutData { get; set; } + + [Key(2)] + public RentData? RentData { get; set; } + } + + [MessagePackObject()] + public class JianJie + { + [Key(0)] + public string? OriginallData { get; set; } + } + + [MessagePackObject()] + public class CheckInData + { + [Key(0)] + public string? key { get; set; } + + [Key(1)] + public string? code { get; set; } + + [Key(2)] + public string? roomNumber { get; set; } + + [Key(3)] + public DateTime checkInDate; + + [Key(4)] + public string? xmlString { get; set; } + + [Key(5)] + public string? phoneNumber { get; set; } + + [Key(6)] + public string? idNumber { get; set; } + } + + [MessagePackObject()] + public class CheckOutData + { + + [Key(0)] + public string? key { get; set; } + + [Key(1)] + public string? code { get; set; } + + [Key(2)] + public string? roomNumber { get; set; } + + [Key(3)] + public DateTime checkOutDate { get; set; } + } + + [MessagePackObject()] + public class RentData + { + [Key(0)] + public string? key { get; set; } + + [Key(1)] + public string? code { get; set; } + + [Key(2)] + public string? roomNumber { get; set; } + + [Key(3)] + public DateTime rentDate { get; set; } + } +} diff --git a/CommonEntity/ReturnInfo.cs b/CommonEntity/ReturnInfo.cs new file mode 100644 index 0000000..b7a74f7 --- /dev/null +++ b/CommonEntity/ReturnInfo.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CommonEntity +{ + public class ReturnInfo + { + public bool isok { set; get; } // 是否成功,true成功 + public string message { set; get; } // 传递接口信息,or报错信息 + public int status { set; get; } // 服务器报错信息,正确为200,错误404/500等 + public object response { set; get; } // 获取到的信息本体,若报错则为null + } +} diff --git a/CommonEntity/UDPPackage.cs b/CommonEntity/UDPPackage.cs new file mode 100644 index 0000000..95b51d6 --- /dev/null +++ b/CommonEntity/UDPPackage.cs @@ -0,0 +1,514 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MessagePack; +using MongoDB.Bson; + +namespace CommonEntity +{ + public class KafkaKey + { + /// + /// 自己用 的系统的主题 + /// + public static string BLWLog_RCU_Topic = "blwlog-rcu-udppackage-topic"; + + /// + /// 新数据会分区 + /// + public static string BLWLog_RCU_Topic_Partition = "blwlog-data-topic"; + //public static string BLWLog_RCU_Topic_Partition = "firsttopic"; + + + /// + /// 宝镜系统使用的数据 + /// + public static string BLWLog4BaoJing_RCU_Topic = "blwlog4BaoJing-rcu-udppackage-topic"; + + /// + /// 设备动作数据 + /// + public static string UDPPackage_ActionData = "action_change_push"; + + + + public static string UDPPackageKey = "blwlog-rcu-topic"; + public static string UDPPackageForkSystemKey = "forksystem"; + public static string UDPPackageStepMonitor = "stepmonitor"; + public static string UDPPackagePowerMonitor = "power"; + public static string UDPPackageWholeDataMonitor = "original-power-data"; + public static string IotMonitor = "iot"; + + public static string RCUOnLineStatus = "rcu-status"; + public static string TakeCardStatus = "takecard-status"; + public static string ServiceInfoStatus = "serviceinfo-status"; + public static string InvokceThirdHttpInterface = "invoke3httpinterface"; + public static string PMSLogMonitor = "pms"; + + + + public static string RCUNewVersion_RestartReason = "restart-reason"; + public static string RCUNewVersion_TakeCard = "takecard"; + public static string RCUNewVersion_0E = "0X0E"; + public static string RCUNewVersion_Register = "0X01"; + public static string RCUNewTimerData = "0X34"; + } + //public class UDPPackage + //{ + // public string? CommandType { get; set; } + // public long TotalCount { get; set; } + // public Dictionary FenLei { get; set; } + // public string? RemoveTime { get; set; } + //} + [MessagePackObject] + public class UDPPackage + { + [Key(0)] + public string? CommandType { get; set; } + [Key(1)] + public long TotalCount { get; set; } + [Key(2)] + public Dictionary FenLei { get; set; } + [Key(3)] + public string? RemoveTime { get; set; } + + [Key(4)] + public Dictionary ExtraData { get; set; } + + } + + + [MessagePackObject()] + public class StepInfo + { + [Key(0)] + public string MessageId { get; set; } + + [Key(1)] + public string? TriggerTime { get; set; } + + [Key(2)] + public double Step { get; set; } + + [Key(3)] + public string? StepDescription { get; set; } + + [Key(4)] + public byte[]? Content { get; set; } + [Key(5)] + public long EveryMessageId { get; set; } + [Key(6)] + public long Monitor_0E_01 { get; set; } + + [Key(7)] + public string? HotelCode { get; set; } + [Key(8)] + public string? HostNumber { get; set; } + } + + [MessagePackObject()] + public class DingShiReportDate + { + [Key(0)] + /// + /// HostID + /// + public int HostID { get; set; } + + /// + /// 设备类型 + /// + [Key(1)] + public string DeviceType { get; set; } + + /// + /// 设备地址 + /// + [Key(2)] + public string Address { get; set; } + /// + /// 状态:1开,2关 + /// + + [Key(3)] + public int Status { get; set; } + /// + /// 亮度 + /// + [Key(4)] + public int Brightness { get; set; } + /// + /// 当前温度 + /// + [Key(5)] + public int CurrentTemp { get; set; } + /// + /// 设定温度 + /// + [Key(6)] + public int SettingTemp { get; set; } + /// + /// 风速 + /// + [Key(7)] + public int FanSpeed { get; set; } + /// + /// 模式 + /// + [Key(8)] + public int Mode { get; set; } + /// + /// 阀门 + /// + [Key(9)] + public int Valve { get; set; } + } + + [MessagePackObject()] + public class NengHao + { + [Key(0)] + public long HotelCode { get; set; } + [Key(1)] + public string? HostNumber { get; set; } + + [Key(2)] + public string? Mac { get; set; } + + [Key(3)] + public string? EndPoint { get; set; } + + [Key(4)] + public string? Version { get; set; } + + [Key(5)] + public bool IsTakeCard { get; set; } + + [Key(6)] + public double V { get; set; } + + [Key(7)] + public double A { get; set; } + + [Key(8)] + public double P { get; set; } + + /// + /// 能耗 + /// + [Key(9)] + public double Energy_Consumption { get; set; } + + /// + /// 总能耗 + /// + [Key(10)] + public double Sum_Energy_Consumption { get; set; } + + [Key(11)] + public long CreateTime { get; set; } + + [Key(12)] + public string? ReportTime { get; set; } + + [Key(13)] + public string? RoomNumber { get; set; } + + [Key(14)] + public int CarbonVIP { get; set; } + + [Key(15)] + public List? AllDeviceData { get; set; } + + [Key(16)] + public int IdentityInfo { get; set; } + } + + [MessagePackObject()] + public class NewRoomtusPush + { + /// + /// 酒店编码 + /// + [Key(0)] + public long code { get; set; } + + [Key(1)] + public string hostnumber { get; set; } + /// + /// 房号 + /// + [Key(2)] + public string roomNumber { get; set; } + /// + /// 回路地址 + /// + + [Key(3)] + public string address { get; set; } + /// + /// 回路名称 + /// + [Key(4)] + public string name { get; set; } + /// + /// 状态 + /// + [Key(5)] + public int status { get; set; } + + /// + /// 亮度 + /// + [Key(6)] + public int brightness { get; set; } + /// + /// 当前温度 + /// + [Key(7)] + public int currentTemp { get; set; } + /// + /// 设定温度 + /// + [Key(8)] + public int settingTemp { get; set; } + /// + /// 风速 + /// + [Key(9)] + public int fanSpeed { get; set; } + /// + /// 模式 + /// + [Key(10)] + public int mode { get; set; } + /// + /// 阀门 + /// + [Key(11)] + public int valve { get; set; } + + [Key(12)] + public long createtime { get; set; } + } + + + + [MessagePackObject()] + public class OtherServiceInfo + { + [Key(0)] + public string? HotelCode { get; set; } + + [Key(1)] + public string? HostNumber { get; set; } + + [Key(2)] + public string? Address { get; set; } + + [Key(3)] + public ushort StatusReceiver { get; set; } + + [Key(4)] + public DateTime LastUpdateTime { get; set; } + } + + + [MessagePackObject()] + public class Interface3Log + { + [Key(0)] + public string? HotelCode { get; set; } + + [Key(1)] + public string? HostNumber { get; set; } + + [Key(2)] + public string? RoomNumber { get; set; } + + [Key(3)] + public HttpActionData? ActionData { get; set; } + + [Key(4)] + public DateTime TriggerTime { get; set; } + + [Key(5)] + public string? CommandType { get; set; } + } + + [MessagePackObject()] + public class HttpActionData + { + [Key(0)] + public double Step { get; set; } + + [Key(1)] + public string? RequestData { get; set; } + + [Key(2)] + public string? ResponseData { get; set; } + } + + + + public class Interface3Log_db + { + public ObjectId _id { get; set; } + public string? HotelCode { get; set; } + public string? HostNumber { get; set; } + public string? RoomNumber { get; set; } + public HttpActionData? ActionData { get; set; } + public DateTime TriggerTime { get; set; } + public string? CommandType { get; set; } + } + + public class StepInfo_db + { + public ObjectId _id { get; set; } + public string MessageId { get; set; } + public DateTime? TriggerTime { get; set; } + public string? TriggerTimeString { get; set; } + public double Step { get; set; } + public string? StepDescription { get; set; } + public byte[]? Content { get; set; } + + public long EveryMessageId { get; set; } + public long Monitor_0E_01 { get; set; } + + public string? HotelCode { get; set; } + public string? HostNumber { get; set; } + } + public class UDPPackage_db + { + public ObjectId _id { get; set; } + public string? CommandType { get; set; } + public long TotalCount { get; set; } + public Dictionary FenLei { get; set; } + public Dictionary ExtraData { get; set; } + public DateTime RemoveTime { get; set; } + public string? RemoveTimeString { get; set; } + } + + public class NengHao_db + { + public ObjectId _id { get; set; } + public long HotelCode { get; set; } + public string? HostNumber { get; set; } + public string? Mac { get; set; } + public string? EndPoint { get; set; } + public string? Version { get; set; } + public bool IsTakeCard { get; set; } + public double V { get; set; } + public double A { get; set; } + public double P { get; set; } + public double Energy_Consumption { get; set; } + public double Sum_Energy_Consumption { get; set; } + public long CreateTime { get; set; } + public DateTime ReportTime { get; set; } + + public string? RoomNumber { get; set; } + public int CarbonVIP { get; set; } + + public List? AllDeviceData { get; set; } + public int IdentityInfo { get; set; } + } + + + public class OtherServiceInfo_db + { + public ObjectId _id { get; set; } + public string? HotelCode { get; set; } + public string? HostNumber { get; set; } + public string? Address { get; set; } + public ushort StatusReceiver { get; set; } + public DateTime LastUpdateTime { get; set; } + } + + public class QueryDate + { + public string? HotelCode { get; set; } + public string? HostNumber { get; set; } + + public string? Mac { get; set; } + public string Start_Time { get; set; } + public string End_Time { get; set; } + public int PageSize { get; set; } + public int PageIndex { get; set; } + } + public class TimerData + { + public int interval_Minutes { get; set; } + } + + + public class Root + { + public List data { get; set; } + } + public class DataItem + { + /// + /// + /// + public string ExtendedLocation { get; set; } + /// + /// + /// + public string OriginQuery { get; set; } + /// + /// + /// + public string appinfo { get; set; } + /// + /// + /// + public int disp_type { get; set; } + /// + /// + /// + public string fetchkey { get; set; } + /// + /// 本地局域网 + /// + public string location { get; set; } + /// + /// + /// + public string origip { get; set; } + /// + /// + /// + public string origipquery { get; set; } + /// + /// + /// + public string resourceid { get; set; } + /// + /// + /// + public int role_id { get; set; } + /// + /// + /// + public int shareImage { get; set; } + /// + /// + /// + public int showLikeShare { get; set; } + /// + /// + /// + public string showlamp { get; set; } + /// + /// IP地址查询 + /// + public string titlecont { get; set; } + /// + /// + /// + public string tplt { get; set; } + } +} diff --git a/CommonTools/CPUData.cs b/CommonTools/CPUData.cs new file mode 100644 index 0000000..d842aff --- /dev/null +++ b/CommonTools/CPUData.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CommonTools +{ + public class CPUData + { + public static double GetCPU() + { + PerformanceCounter cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total"); + cpuCounter.NextValue(); // 初始化计数器,让它开始计数 + System.Threading.Thread.Sleep(1000); // 等待一秒 + double cpuUsage = cpuCounter.NextValue(); // 获取CPU使用率 + return cpuUsage; + } + } +} diff --git a/CommonTools/CSRedisCacheHelper.cs b/CommonTools/CSRedisCacheHelper.cs new file mode 100644 index 0000000..db17221 --- /dev/null +++ b/CommonTools/CSRedisCacheHelper.cs @@ -0,0 +1,164 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Configuration; +using CSRedis; + +namespace Common +{ + /// + /// Redis缓存辅助类 + /// + public class CSRedisCacheHelper + { + public static CSRedisClient? redis; + public static CSRedisClient? redis0; + public static CSRedisClient? redis1; + public static CSRedisClient? redis2; + public static CSRedisClient? redis3; + public static CSRedisClient? redis4; + public static CSRedisClient? redis5; + + private const string ip = "127.0.0.1"; + private const string port = "6379"; + static CSRedisCacheHelper() + { + var redisHostStr = string.Format("{0}:{1}", ip, port); + if (!string.IsNullOrEmpty(redisHostStr)) + { + redis0 = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=0"); + redis = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=1"); + redis2 = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=2"); + redis3 = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=3"); + redis4 = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=4"); + //准备存储取电数据 + redis5 = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=5"); + + } + } + /// + /// 添加缓存 + /// + /// + /// + /// + public static void Set(string key, T value, int ExpireTime) + { + redis?.Set(key, value, ExpireTime * 60); + } + + public static T Get(string key) + { + return redis.Get(key); + } + + public static void Forever(string key, T value) + { + redis.Set(key, value, -1); + } + public static void Del(string key) + { + redis.Del(key); + } + + public static void Del_Partition(string key,int SliceNo=2) + { + CSRedisClient client = WhitchRedisSlice(SliceNo); + client.Del(key); + } + + /// + /// 判断是否存在 + /// + /// + /// + /// + public static bool Contains(string key, string mac) + { + bool result = redis.Exists(mac); + if (!result) + { + result = redis.Exists(key); + } + return result; + } + + + public static int ExpireMinutes = 10; + public static T Get_Partition(string key, int SliceNo = 2) + { + CSRedisClient client = WhitchRedisSlice(SliceNo); + return client.Get(key); + } + public static void Set_Partition(string key, T value, int SliceNo = 2) + { + CSRedisClient client = WhitchRedisSlice(SliceNo); + client.Set(key, value, ExpireMinutes * 60 * 60); + } + + /// + /// 设置过期时间 + /// + /// + /// + /// + /// + /// + public static void Set_PartitionWithTime(string key, T value, int ExpireTime_Minutes, int SliceNo = 2) + { + CSRedisClient client = WhitchRedisSlice(SliceNo); + client.Set(key, value, ExpireTime_Minutes * 60); + } + public static void Set_PartitionWithForever(string key, T value, int SliceNo = 2) + { + CSRedisClient client = WhitchRedisSlice(SliceNo); + client.Set(key, value, -1); + } + public static void Del_Partition(string[] key, int SliceNo = 2) + { + CSRedisClient client = WhitchRedisSlice(SliceNo); + client.Del(key); + } + public static bool Contains_Partition(string key, int SliceNo = 2) + { + CSRedisClient client = WhitchRedisSlice(SliceNo); + bool result = client.Exists(key); + return result; + } + private static CSRedisClient WhitchRedisSlice(int SliceNo) + { + CSRedisClient client = null; + if (SliceNo == 1) + { + client = redis1; + } + else if (SliceNo == 2) + { + client = redis2; + } + else if (SliceNo == 3) + { + client = redis3; + } + else if (SliceNo == 4) + { + client = redis4; + } + else if (SliceNo == 5) + { + client = redis5; + } + else + { + client = redis; + } + return client; + } + + public static long GetForever_ExpireMinutes(string key) + { + return redis.Ttl(key); + } + } +} diff --git a/CommonTools/CommonTools.csproj b/CommonTools/CommonTools.csproj new file mode 100644 index 0000000..d68e933 --- /dev/null +++ b/CommonTools/CommonTools.csproj @@ -0,0 +1,15 @@ + + + + net8.0 + enable + enable + + + + + + + + + diff --git a/CommonTools/MyMessagePacker.cs b/CommonTools/MyMessagePacker.cs new file mode 100644 index 0000000..c10f209 --- /dev/null +++ b/CommonTools/MyMessagePacker.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MessagePack; + +namespace CommonTools +{ + public class MyMessagePacker + { + public static byte[] FastSerialize(T t) + { + byte[] bytes = MessagePackSerializer.Serialize(t); + return bytes; + } + public static T FastDeserialize(byte[] bytes) + { + T mc2 = MessagePackSerializer.Deserialize(bytes); + return mc2; + } + } + + + [MessagePackObject] + public class MyClass + { + // Key attributes take a serialization index (or string name) + // The values must be unique and versioning has to be considered as well. + // Keys are described in later sections in more detail. + [Key(0)] + public int Age { get; set; } + + [Key(1)] + public string FirstName { get; set; } + + [Key(2)] + public string LastName { get; set; } + + // All fields or properties that should not be serialized must be annotated with [IgnoreMember]. + [IgnoreMember] + public string FullName { get { return FirstName + LastName; } } + } +} diff --git a/CommonTools/Tools.cs b/CommonTools/Tools.cs new file mode 100644 index 0000000..86fa4eb --- /dev/null +++ b/CommonTools/Tools.cs @@ -0,0 +1,628 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Drawing.Imaging; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Text; +using System.Security.Cryptography; +using System.Web; +using System.ComponentModel; +using System.Text.RegularExpressions; + +namespace CommonTools +{ + public static class Tools + { + + /// + /// 获取本地IP地址 + /// + /// + public static string GetLocalIP() + { + string localIp = ""; + + IPAddress[] addressList = Dns.GetHostAddresses(Dns.GetHostName());//会返回所有地址,包括IPv4和IPv6 + foreach (IPAddress ip in addressList) + { + if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + { + localIp = ip.ToString(); + break; + } + } + + return localIp; + } + /// + /// 将主机名或 IP 地址解析IP地址 + /// + /// + /// + public static IPAddress GetIPByDomain(string hostNameOrAddress) + { + IPHostEntry host = Dns.GetHostEntry(hostNameOrAddress); + return host.AddressList[0]; + } + + /// + /// 获取本地IP地址列表 + /// + /// + public static IList GetLocalIPList() + { + IList localIpList = new List(); + + IPAddress[] addressList = Dns.GetHostAddresses(Dns.GetHostName());//会返回所有地址,包括IPv4和IPv6 + foreach (IPAddress ip in addressList) + { + if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + { + localIpList.Add(ip.ToString()); + } + } + + return localIpList; + } + + public static string GetApplicationPath() + { + return AppDomain.CurrentDomain.SetupInformation.ApplicationBase; + } + /// + /// 获取记录访问量文件路径 + /// + /// + public static string GetCounterFilePath() + { + return GetApplicationPath() + @"License\counter.txt"; + } + + /// + /// 生成CRC16校验 + /// + /// + /// + /// + public static ushort CRC16(byte[] buffer, int len) + { + uint xda, xdapoly; + byte xdabit; + xda = 0xFFFF; + xdapoly = 0xA001; // (X**16 + X**15 + X**2 + 1) + + for (int i = 0; i < len; i++) + { + xda ^= buffer[i]; + for (int j = 0; j < 8; j++) + { + xdabit = (byte)(xda & 0x01); + xda >>= 1; + if (xdabit == 1) + { + xda ^= xdapoly; + } + } + } + return Convert.ToUInt16(xda & 0xffff); + } + + /// + /// 计算文件的MD5值 + /// + /// + /// + public static byte[] MD5(string file) + { + using (Stream stream = File.Open(file, FileMode.Open)) + { + return MD5(stream); + } + } + + /// + /// 计算流的MD5值 + /// + /// + /// + public static byte[] MD5(Stream stream) + { + using (MD5 md5 = new MD5CryptoServiceProvider()) + { + return md5.ComputeHash(stream); + } + } + /// + /// 计算文件MD5 + /// + /// + /// + public static string ComputeFileHash(Stream stream) + { + byte[] retVal = Tools.MD5(stream); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < retVal.Length; i++) + { + sb.Append(retVal[i].ToString("x2")); + } + return sb.ToString(); + } + + /// + /// 将MD5字符串转换成整型数组表示 + /// + /// + /// + public static uint[] MD5StringToUIntArray(string md5) + { + if (String.IsNullOrWhiteSpace(md5)) + { + throw new ArgumentException("参数不能为空。", "md5"); + } + + try + { + uint[] md5Arr = new uint[4] { 0, 0, 0, 0 }; + + md5Arr[0] = Convert.ToUInt32(md5.Substring(0, 8), 16); + md5Arr[1] = Convert.ToUInt32(md5.Substring(8, 8), 16); + md5Arr[2] = Convert.ToUInt32(md5.Substring(16, 8), 16); + md5Arr[3] = Convert.ToUInt32(md5.Substring(24, 8), 16); + + return md5Arr; + } + catch (Exception ex) + { + throw new ApplicationException("转换MD5出错。", ex); + } + } + /// + /// 用MD5加密字符串 + /// + /// 待加密的字符串 + /// + public static string MD5Encrypt(string str) + { + MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider(); + byte[] hashedDataBytes; + hashedDataBytes = md5Hasher.ComputeHash(Encoding.UTF8.GetBytes(str)); + StringBuilder tmp = new StringBuilder(); + foreach (byte i in hashedDataBytes) + { + tmp.Append(i.ToString("x2")); + } + return tmp.ToString(); + } + /// + /// 获取指定长的的字符串对应的16进制字节码,如果长度不够,末位自动补0 + /// + /// + /// + /// + public static byte[] GetBytes(String str, int length) + { + byte[] s = System.Text.Encoding.GetEncoding("gb2312").GetBytes(str); + int fixLength = length - s.Length; + if (s.Length < length) + { + byte[] S_bytes = new byte[length]; + Array.Copy(s, 0, S_bytes, 0, s.Length); + for (int x = length - fixLength; x < length; x++) + { + S_bytes[x] = 0x00; + } + return S_bytes; + } + return s; + } + /// + /// 获取一个随机数组 + /// + /// 数组个数 + /// + /// + /// + public static int[] GetRandomNum(int num, int minValue, int maxValue) + { + Random ra = new Random(unchecked((int)DateTime.Now.Ticks)); + int[] arrNum = new int[num]; + int tmp = 0; + for (int i = 0; i <= num - 1; i++) + { + tmp = ra.Next(minValue, maxValue); //随机取数 + arrNum[i] = tmp; + } + return arrNum; + } + + /// + /// 解决下载名称在IE下中文乱码 + /// + /// + /// + public static String ToUtf8String(String s) + { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < s.Length; i++) + { + char c = s[i]; + if (c >= 0 && c <= 255) + { + sb.Append(c); + } + else + { + byte[] b; + try + { + b = Encoding.UTF8.GetBytes(c.ToString()); + } + catch (Exception) + { + b = new byte[0]; + } + for (int j = 0; j < b.Length; j++) + { + int k = b[j]; + if (k < 0) k += 256; + + sb.Append("%" + Convert.ToString(k, 16).ToUpper()); + } + } + } + return sb.ToString(); + } + /// + /// 字节内容转换为字符串 + /// + /// + /// + public static string ByteToString(byte[] bytesData) + { + StringBuilder result = new StringBuilder(); + foreach (byte r in bytesData) + { + result.Append(r.ToString("X2") + " "); + } + return result.ToString(); + } + /// + /// 把int32类型的数据转存到2个字节的byte数组中 + /// + /// int32类型的数据 + /// 2个字节大小的byte数组 + /// + public static byte[] Int32ToByte(Int32 data) + { + byte[] arry = new byte[2]; + arry[0] = (byte)((data & 0xFF00) >> 8); + arry[1] = (byte)(data & 0xFF); + return arry; + } + /// + /// 把int32类型的数据转存到2个字节的byte数组中:小端 + /// + /// + /// + public static byte[] Int32ToByte2(Int32 data) + { + byte[] arry = new byte[2]; + arry[0] = (byte)(data & 0xFF); + arry[1] = (byte)((data & 0xFF00) >> 8); + //arry[2] = (byte)((data & 0xFF0000) >> 16); + //arry[3] = (byte)((data >> 24) & 0xFF); + + return arry; + } + /// + /// 2位byte转换为int类型 + /// + /// + /// + public static int ByteToInt(byte[] data) + { + return (data[1] & 0xFF) << 8 | data[0]; + } + /// + /// 4位byte转换为long类型 + /// + /// + /// + public static long Byte4ToLong(byte[] data) + { + return (data[3] << 24) & 0xFF | (data[2] & 0xFF00) << 16 | (data[1] & 0xFF) << 8 | data[0]; + } + /// + /// long类型转换为4位byte + /// + /// + /// + public static byte[] LongToByte4(long data) + { + byte[] arry = new byte[4]; + arry[0] = (byte)(data & 0xFF); + arry[1] = (byte)((data & 0xFF00) >> 8); + arry[2] = (byte)((data & 0xFF0000) >> 16); + arry[3] = (byte)((data >> 24) & 0xFF); + + return arry; + } + /// + /// 在指定时间过后执行指定的表达式 + /// + /// 事件之间经过的时间(以毫秒为单位) + /// 要执行的表达式 + public static void SetTimeout(double interval, Action action) + { + System.Timers.Timer timer = new System.Timers.Timer(interval); + timer.Elapsed += delegate (object sender, System.Timers.ElapsedEventArgs e) + { + timer.Enabled = false; + action(); + }; + timer.Enabled = true; + } + + /// + /// 得到字符串的长度,一个汉字算2个字符 + /// + /// 字符串 + /// 返回字符串长度 + public static int GetLength(string str) + { + if (str.Length == 0) return 0; + + ASCIIEncoding ascii = new ASCIIEncoding(); + int tempLen = 0; + byte[] s = ascii.GetBytes(str); + for (int i = 0; i < s.Length; i++) + { + if ((int)s[i] == 63) + { + tempLen += 2; + } + else + { + tempLen += 1; + } + } + return tempLen; + } + /// + /// 获取枚举描述 + /// + /// 枚举 + /// 返回枚举的描述 + public static string GetDescription(Enum en) + { + Type type = en.GetType();//获取类型 + MemberInfo[] memberInfos = type.GetMember(en.ToString()); //获取成员 + if (memberInfos != null && memberInfos.Length > 0) + { + DescriptionAttribute[] attrs = memberInfos[0].GetCustomAttributes(typeof(DescriptionAttribute), false) as DescriptionAttribute[]; //获取描述特性 + if (attrs != null && attrs.Length > 0) + { + return attrs[0].Description; //返回当前描述 + } + } + return en.ToString(); + } + /// + /// stream to reader + /// + /// + /// + public static string StreamToString(Stream stream) + { + stream.Position = 0; + using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) + { + return reader.ReadToEnd(); + } + } + /// + /// HEX编码转换为——>ASCII编码 + /// + /// + /// + public static string HexToASCII(string Msg) + { + byte[] buff = new byte[Msg.Length / 2]; + string Message = ""; + for (int i = 0; i < buff.Length; i++) + { + buff[i] = byte.Parse(Msg.Substring(i * 2, 2), System.Globalization.NumberStyles.HexNumber); + } + System.Text.Encoding chs = System.Text.Encoding.ASCII; + Message = chs.GetString(buff); + return Message; + } + /// + /// HEX编码转换为——>字符串 + /// + /// + /// + public static string HexToStr(string Msg) + { + byte[] buff = new byte[Msg.Length / 2]; + string Message = ""; + for (int i = 0; i < buff.Length; i++) + { + buff[i] = byte.Parse(Msg.Substring(i * 2, 2), System.Globalization.NumberStyles.HexNumber); + } + System.Text.Encoding chs = System.Text.Encoding.GetEncoding("gb2312"); + Message = chs.GetString(buff); + return Message; + } + /// + /// 字符串转化为——>HEX编码 + /// + /// + /// + public static string StrToHex(string Msg) + { + byte[] bytes = System.Text.Encoding.Default.GetBytes(Msg);//转换为字节(十进制) + string str = ""; + for (int i = 0; i < bytes.Length; i++) + { + str += string.Format("{0:X}", bytes[i]); //转换为十六进制 + } + return str; + } + /// + /// Hex文件解释 + /// + /// + public static void HexFileRead(string filepath)//从指定文件目录读取HEX文件并解析,放入缓存数组buffer中 + { + string szLine; + int startAdr; + int endAdr = 0; //用于判断hex地址是否连续,不连续补充0xFF + + byte[] buffer = new byte[1024 * 1024 * 5]; // 打开文件hex to bin缓存 + int bufferAdr = 0;// 打开文件hex to bin缓存指针,用于计算bin的长度 + + if (filepath == "") + { + return; + } + + FileStream fsRead = new FileStream(filepath, FileMode.OpenOrCreate, FileAccess.Read); + StreamReader HexReader = new StreamReader(fsRead); //读取数据流 + while (true) + { + szLine = HexReader.ReadLine(); //读取Hex中一行 + if (szLine == null) { break; } //读取完毕,退出 + if (szLine.Substring(0, 1) == ":") //判断首字符是”:” + { + if (szLine.Substring(1, 8) == "00000001") { break; } //文件结束标识 + if ((szLine.Substring(8, 1) == "0") || (szLine.Substring(8, 1) == "1"))//直接解析数据类型标识为 : 00 和 01 的格式 + { + int lineLenth; + string hexString; + + hexString = szLine.Substring(1, 2); + lineLenth = Int32.Parse(hexString, System.Globalization.NumberStyles.HexNumber); // 获取一行的数据个数值 + + hexString = szLine.Substring(3, 4); + startAdr = Int32.Parse(hexString, System.Globalization.NumberStyles.HexNumber); // 获取地址值 + + for (int i = 0; i < startAdr - endAdr; i++) // 补空位置 + { + hexString = "FF"; + byte value = byte.Parse(hexString, System.Globalization.NumberStyles.HexNumber); + buffer[bufferAdr] = value; + bufferAdr++; + } + + for (int i = 0; i < lineLenth; i++) // hex转换为byte + { + hexString = szLine.Substring(i * 2 + 9, 2); + byte value = byte.Parse(hexString, System.Globalization.NumberStyles.HexNumber); + buffer[bufferAdr] = value; + bufferAdr++; + } + endAdr = startAdr + lineLenth; + } + } + } + } + /// + /// 将url参数转成json + /// + /// + /// + public static string UrlParamsToJson(string urlParams) + { + var nameValueCollection = HttpUtility.ParseQueryString(urlParams); + var json = Newtonsoft.Json.JsonConvert.SerializeObject(nameValueCollection.AllKeys.ToDictionary(k => k, k => nameValueCollection[k])); + return json; + } + //public static string GetUrl(string url) + //{ + // ComputeSignature(); + // return "http://"+ url + "/?" + + // string.Join("&", _parameters.Select(x => x.Key + "=" + HttpUtility.UrlEncode(x.Value))); + //} + + public static long GetCurrentTimeStamp(DateTime dt) + { + TimeSpan ts = dt - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Local); + long current_timestamp = Convert.ToInt64(ts.TotalSeconds); + return current_timestamp; + } + public static DateTime GetCurrentDateTime(long timestampMilliseconds) + { + DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local); + DateTime utcTime = epoch.AddSeconds(timestampMilliseconds); + return utcTime; + } + + /// + /// 格林尼治时间 + /// + /// + public static long GetUnixTime() + { + DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + long unixTimestampMillisecondsManual = (long)(DateTime.UtcNow - unixEpoch).TotalSeconds; + return unixTimestampMillisecondsManual; + } + public static DateTime GetTimeFromUnixTime(long timestampSeconds) + { + // Unix 时间戳的起始时间(1970-01-01 00:00:00 UTC) + DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); + + // 加上 Unix 时间戳的秒数 + return unixEpoch.AddSeconds(timestampSeconds); + } + + + public static byte CombineBitsToByte(bool bit0, bool bit1, bool bit2, bool bit3) + { + byte result = (byte)((bit0 ? 1 : 0) << 3); // 将bit0移到第4位(高位) + result |= (byte)((bit1 ? 1 : 0) << 2); // 将bit1移到第3位 + result |= (byte)((bit2 ? 1 : 0) << 1); // 将bit2移到第2位 + result |= (byte)(bit3 ? 1 : 0); // 将bit3移到第1位(低位) + return result; + } + + /// + /// 16进制字符串转换成 字节数组 + /// + /// + /// + public static byte[] GetBytesFromString(string hexString) + { + hexString = DeleteSpaceChar(hexString); + byte[] bytes = new byte[hexString.Length / 2]; // 计算字节数组的长度 + for (int i = 0; i < bytes.Length; i++) + { + bytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16); // 每次取两个字符转换为字节 + } + return bytes; + } + public static string DeleteSpaceChar(string originalString) + { + string result = Regex.Replace(originalString, @"\s", ""); + return result; + } + + public static short HostNumberToHotelCode(string wer) + { + var v1 = wer.Substring(0, 3); + var v2 = wer.Substring(3, 3); + + byte b12 = byte.Parse(v1); + byte b13 = byte.Parse(v2); + + byte[] vva1 = new byte[] { b12, b13 }; + var usa = BitConverter.ToInt16(vva1, 0); + return usa; + } + } +} diff --git a/ConsoleApp1/MLModel1.mbconfig b/ConsoleApp1/MLModel1.mbconfig new file mode 100644 index 0000000..e3c4bc5 --- /dev/null +++ b/ConsoleApp1/MLModel1.mbconfig @@ -0,0 +1,14 @@ +{ + "Scenario": "Default", + "Environment": { + "Type": "LocalCPU", + "Version": 1 + }, + "Type": "TrainingConfig", + "Version": 5, + "TrainingOption": { + "Version": 1, + "Type": "DefaultTrainingOption", + "TrainingTime": 0 + } +} \ No newline at end of file diff --git a/ConsoleApp1/Program.cs b/ConsoleApp1/Program.cs new file mode 100644 index 0000000..47618ab --- /dev/null +++ b/ConsoleApp1/Program.cs @@ -0,0 +1,165 @@ +using System.Text; +using System.Text.Json; +using CommonEntity; +using Confluent.Kafka; +using MessagePack; +using MongoDB.Bson; +using MongoDB.Driver; + +namespace ConsoleApp1 +{ + internal class Program + { + static void Main(string[] args) + { + //MongoDBMMMM(); + WriteLog().Wait(); + //MongoDBAdd(); + //MongoDB(); + Console.ReadKey(); + } + + public static void MongoDBMMMM() + { + var connectionString = "mongodb://blv-rd-admin:A*%26(y*DG%26v(AS%26Di7gct@10.8.8.210:27017/"; + var client = new MongoClient(connectionString); + + var collection = client.GetDatabase("udppackage").GetCollection("zeroe_stepmonitor"); + StepInfo_db us = new StepInfo_db(); + us.MessageId = "test"; + us.Step = 11.11; + us.StepDescription = "测试使用"; + us.Content = new byte[] { }; + us.TriggerTime = DateTime.Now; + us.EveryMessageId = 1; + us.Monitor_0E_01 = 1; + us.HostNumber = "8888"; + us.HotelCode = "8888"; + collection.InsertOne(us); + } + + public static void MongoDBAdd() + { + + var connectionString = "mongodb://localhost:27017/"; + if (connectionString == null) + { + Environment.Exit(0); + } + var client = new MongoClient(connectionString); + var collection = client.GetDatabase("blwlog").GetCollection("udppackage"); + + List list1 = new List(); + Random r111 = new Random(); + + for (int i = 0; i < 100000; i++) + { + LogBase r = new LogBase(); + DataContext ddd = new DataContext(); + var iiu = r111.Next(1, 300); + + ddd.Age = iiu; + r.Context = ddd; + r.CreateDateTime = DateTime.Now; + r.HotelCode = "1001"; + list1.Add(r); + Task.Delay(10); + } + collection.InsertMany(list1); + } + + public static void MongoDB() + { + + var connectionString = "mongodb://localhost:27017/"; + if (connectionString == null) + { + Environment.Exit(0); + } + var client = new MongoClient(connectionString); + var collection = client.GetDatabase("blwlog").GetCollection("udppackage"); + + //构建查询条件 + var filter = Builders.Filter.Gt("Context.Age", 20); + + + + // //执行查询 + var results = collection.Find(filter).ToList(); + + // //输出结果 + foreach (var doc in results) + { + Console.WriteLine(doc.ToJson()); + } + } + public class UUU + { + public string Name { get; set; } + public int Age { get; set; } + } + + + + + public static async Task WriteLog() + { + + var config = new ProducerConfig + { + //BootstrapServers = "43.138.217.154:9092", + BootstrapServers = "172.16.4.132:9092", + SecurityProtocol = SecurityProtocol.SaslPlaintext, + SaslMechanism = SaslMechanism.Plain, + SaslUsername = "blwmomo", + SaslPassword = "blwmomo" + }; + using (var p = new ProducerBuilder(config).Build()) + { + try + { + //UDPPackage u = new UDPPackage(); + //u.CommandType = "aaa"; + //u.FenLei = new Dictionary(); + //u.FenLei.Add("111", 222); + //u.RemoveTime = DateTime.Now.ToString(); + //byte[] bbb = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(u)); + //byte[] bytes = MessagePackSerializer.Serialize(u); + + var topic = "blwlog-rcu-udppackage-topic"; + //for (int i = 0; i < 3; i++) + //{ + // var dr = await p.ProduceAsync(topic, new Message { Key = "testtest", Value = "hello" }); + // Console.WriteLine($"Delivered '{dr.Value}' to '{dr.TopicPartitionOffset}'"); + //} + for (int i = 0; i < 30; i++) + { + var partition = new Partition(0); // 指定分区号 + var topicPartition = new TopicPartition(topic, partition); + var dr = await p.ProduceAsync(topicPartition, new Message { Key = "testtest", Value = "hello0"}); + Console.WriteLine($"Delivered '{dr.Value}' to '{dr.TopicPartitionOffset}'"); + } + for (int i = 0; i < 550; i++) + { + var partition = new Partition(1); // 指定分区号 + var topicPartition = new TopicPartition(topic, partition); + var dr = await p.ProduceAsync(topicPartition, new Message { Key = "testtest", Value = "hello1" }); + Console.WriteLine($"Delivered '{dr.Value}' to '{dr.TopicPartitionOffset}'"); + } + for (int i = 0; i < 770; i++) + { + var partition = new Partition(2); // 指定分区号 + var topicPartition = new TopicPartition(topic, partition); + var dr = await p.ProduceAsync(topicPartition, new Message { Key = "testtest", Value = "hello2"}); + Console.WriteLine($"Delivered '{dr.Value}' to '{dr.TopicPartitionOffset}'"); + } + } + catch (ProduceException e) + { + Console.WriteLine($"Delivery failed: {e.Error.Reason}"); + } + } + await Task.CompletedTask; + } + } +} diff --git a/ConsoleApp1/发布.csproj b/ConsoleApp1/发布.csproj new file mode 100644 index 0000000..ff88faa --- /dev/null +++ b/ConsoleApp1/发布.csproj @@ -0,0 +1,20 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + + + + + diff --git a/ConsoleApp2/ConsoleApp2.csproj b/ConsoleApp2/ConsoleApp2.csproj new file mode 100644 index 0000000..030515f --- /dev/null +++ b/ConsoleApp2/ConsoleApp2.csproj @@ -0,0 +1,21 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + + + + + + diff --git a/ConsoleApp2/ConsoleApp2.csproj.user b/ConsoleApp2/ConsoleApp2.csproj.user new file mode 100644 index 0000000..2446e98 --- /dev/null +++ b/ConsoleApp2/ConsoleApp2.csproj.user @@ -0,0 +1,6 @@ + + + + <_LastSelectedProfileId>E:\tian\BLS\BLWLogServer\ConsoleApp2\Properties\PublishProfiles\FolderProfile.pubxml + + \ No newline at end of file diff --git a/ConsoleApp2/EnergyConsumption.cs b/ConsoleApp2/EnergyConsumption.cs new file mode 100644 index 0000000..27335fc --- /dev/null +++ b/ConsoleApp2/EnergyConsumption.cs @@ -0,0 +1,655 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: EnergyConsumption.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace BLWData.Entity { + + /// Holder for reflection information generated from EnergyConsumption.proto + public static partial class EnergyConsumptionReflection { + + #region Descriptor + /// File descriptor for EnergyConsumption.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static EnergyConsumptionReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChdFbmVyZ3lDb25zdW1wdGlvbi5wcm90bxIOQkxXRGF0YS5FbnRpdHki0wEK", + "EUVuZXJneUNvbnN1bXB0aW9uEhEKCUhvdGVsQ29kZRgBIAEoAxISCgpIb3N0", + "TnVtYmVyGAIgASgJEgsKA01hYxgDIAEoCRIQCghFbmRQb2ludBgEIAEoCRIP", + "CgdWZXJzaW9uGAUgASgJEhIKCklzVGFrZUNhcmQYBiABKAgSCQoBVhgHIAEo", + "ARIJCgFBGAggASgBEgkKAVAYCSABKAESDAoES1dfSBgKIAEoARIQCghTdW1f", + "S1dfSBgLIAEoARISCgpDcmVhdGVUaW1lGAwgASgDYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::BLWData.Entity.EnergyConsumption), global::BLWData.Entity.EnergyConsumption.Parser, new[]{ "HotelCode", "HostNumber", "Mac", "EndPoint", "Version", "IsTakeCard", "V", "A", "P", "KWH", "SumKWH", "CreateTime" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// 定义一个Person消息类型 + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class EnergyConsumption : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnergyConsumption()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::BLWData.Entity.EnergyConsumptionReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnergyConsumption() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnergyConsumption(EnergyConsumption other) : this() { + hotelCode_ = other.hotelCode_; + hostNumber_ = other.hostNumber_; + mac_ = other.mac_; + endPoint_ = other.endPoint_; + version_ = other.version_; + isTakeCard_ = other.isTakeCard_; + v_ = other.v_; + a_ = other.a_; + p_ = other.p_; + kWH_ = other.kWH_; + sumKWH_ = other.sumKWH_; + createTime_ = other.createTime_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnergyConsumption Clone() { + return new EnergyConsumption(this); + } + + /// Field number for the "HotelCode" field. + public const int HotelCodeFieldNumber = 1; + private long hotelCode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long HotelCode { + get { return hotelCode_; } + set { + hotelCode_ = value; + } + } + + /// Field number for the "HostNumber" field. + public const int HostNumberFieldNumber = 2; + private string hostNumber_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HostNumber { + get { return hostNumber_; } + set { + hostNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Mac" field. + public const int MacFieldNumber = 3; + private string mac_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Mac { + get { return mac_; } + set { + mac_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "EndPoint" field. + public const int EndPointFieldNumber = 4; + private string endPoint_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string EndPoint { + get { return endPoint_; } + set { + endPoint_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Version" field. + public const int VersionFieldNumber = 5; + private string version_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Version { + get { return version_; } + set { + version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "IsTakeCard" field. + public const int IsTakeCardFieldNumber = 6; + private bool isTakeCard_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsTakeCard { + get { return isTakeCard_; } + set { + isTakeCard_ = value; + } + } + + /// Field number for the "V" field. + public const int VFieldNumber = 7; + private double v_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double V { + get { return v_; } + set { + v_ = value; + } + } + + /// Field number for the "A" field. + public const int AFieldNumber = 8; + private double a_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double A { + get { return a_; } + set { + a_ = value; + } + } + + /// Field number for the "P" field. + public const int PFieldNumber = 9; + private double p_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double P { + get { return p_; } + set { + p_ = value; + } + } + + /// Field number for the "KW_H" field. + public const int KWHFieldNumber = 10; + private double kWH_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double KWH { + get { return kWH_; } + set { + kWH_ = value; + } + } + + /// Field number for the "Sum_KW_H" field. + public const int SumKWHFieldNumber = 11; + private double sumKWH_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double SumKWH { + get { return sumKWH_; } + set { + sumKWH_ = value; + } + } + + /// Field number for the "CreateTime" field. + public const int CreateTimeFieldNumber = 12; + private long createTime_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long CreateTime { + get { return createTime_; } + set { + createTime_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as EnergyConsumption); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(EnergyConsumption other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HotelCode != other.HotelCode) return false; + if (HostNumber != other.HostNumber) return false; + if (Mac != other.Mac) return false; + if (EndPoint != other.EndPoint) return false; + if (Version != other.Version) return false; + if (IsTakeCard != other.IsTakeCard) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(V, other.V)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(A, other.A)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(P, other.P)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(KWH, other.KWH)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(SumKWH, other.SumKWH)) return false; + if (CreateTime != other.CreateTime) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HotelCode != 0L) hash ^= HotelCode.GetHashCode(); + if (HostNumber.Length != 0) hash ^= HostNumber.GetHashCode(); + if (Mac.Length != 0) hash ^= Mac.GetHashCode(); + if (EndPoint.Length != 0) hash ^= EndPoint.GetHashCode(); + if (Version.Length != 0) hash ^= Version.GetHashCode(); + if (IsTakeCard != false) hash ^= IsTakeCard.GetHashCode(); + if (V != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(V); + if (A != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(A); + if (P != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(P); + if (KWH != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(KWH); + if (SumKWH != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(SumKWH); + if (CreateTime != 0L) hash ^= CreateTime.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HotelCode != 0L) { + output.WriteRawTag(8); + output.WriteInt64(HotelCode); + } + if (HostNumber.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HostNumber); + } + if (Mac.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Mac); + } + if (EndPoint.Length != 0) { + output.WriteRawTag(34); + output.WriteString(EndPoint); + } + if (Version.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Version); + } + if (IsTakeCard != false) { + output.WriteRawTag(48); + output.WriteBool(IsTakeCard); + } + if (V != 0D) { + output.WriteRawTag(57); + output.WriteDouble(V); + } + if (A != 0D) { + output.WriteRawTag(65); + output.WriteDouble(A); + } + if (P != 0D) { + output.WriteRawTag(73); + output.WriteDouble(P); + } + if (KWH != 0D) { + output.WriteRawTag(81); + output.WriteDouble(KWH); + } + if (SumKWH != 0D) { + output.WriteRawTag(89); + output.WriteDouble(SumKWH); + } + if (CreateTime != 0L) { + output.WriteRawTag(96); + output.WriteInt64(CreateTime); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HotelCode != 0L) { + output.WriteRawTag(8); + output.WriteInt64(HotelCode); + } + if (HostNumber.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HostNumber); + } + if (Mac.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Mac); + } + if (EndPoint.Length != 0) { + output.WriteRawTag(34); + output.WriteString(EndPoint); + } + if (Version.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Version); + } + if (IsTakeCard != false) { + output.WriteRawTag(48); + output.WriteBool(IsTakeCard); + } + if (V != 0D) { + output.WriteRawTag(57); + output.WriteDouble(V); + } + if (A != 0D) { + output.WriteRawTag(65); + output.WriteDouble(A); + } + if (P != 0D) { + output.WriteRawTag(73); + output.WriteDouble(P); + } + if (KWH != 0D) { + output.WriteRawTag(81); + output.WriteDouble(KWH); + } + if (SumKWH != 0D) { + output.WriteRawTag(89); + output.WriteDouble(SumKWH); + } + if (CreateTime != 0L) { + output.WriteRawTag(96); + output.WriteInt64(CreateTime); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HotelCode != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(HotelCode); + } + if (HostNumber.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HostNumber); + } + if (Mac.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Mac); + } + if (EndPoint.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(EndPoint); + } + if (Version.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); + } + if (IsTakeCard != false) { + size += 1 + 1; + } + if (V != 0D) { + size += 1 + 8; + } + if (A != 0D) { + size += 1 + 8; + } + if (P != 0D) { + size += 1 + 8; + } + if (KWH != 0D) { + size += 1 + 8; + } + if (SumKWH != 0D) { + size += 1 + 8; + } + if (CreateTime != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(CreateTime); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(EnergyConsumption other) { + if (other == null) { + return; + } + if (other.HotelCode != 0L) { + HotelCode = other.HotelCode; + } + if (other.HostNumber.Length != 0) { + HostNumber = other.HostNumber; + } + if (other.Mac.Length != 0) { + Mac = other.Mac; + } + if (other.EndPoint.Length != 0) { + EndPoint = other.EndPoint; + } + if (other.Version.Length != 0) { + Version = other.Version; + } + if (other.IsTakeCard != false) { + IsTakeCard = other.IsTakeCard; + } + if (other.V != 0D) { + V = other.V; + } + if (other.A != 0D) { + A = other.A; + } + if (other.P != 0D) { + P = other.P; + } + if (other.KWH != 0D) { + KWH = other.KWH; + } + if (other.SumKWH != 0D) { + SumKWH = other.SumKWH; + } + if (other.CreateTime != 0L) { + CreateTime = other.CreateTime; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + HotelCode = input.ReadInt64(); + break; + } + case 18: { + HostNumber = input.ReadString(); + break; + } + case 26: { + Mac = input.ReadString(); + break; + } + case 34: { + EndPoint = input.ReadString(); + break; + } + case 42: { + Version = input.ReadString(); + break; + } + case 48: { + IsTakeCard = input.ReadBool(); + break; + } + case 57: { + V = input.ReadDouble(); + break; + } + case 65: { + A = input.ReadDouble(); + break; + } + case 73: { + P = input.ReadDouble(); + break; + } + case 81: { + KWH = input.ReadDouble(); + break; + } + case 89: { + SumKWH = input.ReadDouble(); + break; + } + case 96: { + CreateTime = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + HotelCode = input.ReadInt64(); + break; + } + case 18: { + HostNumber = input.ReadString(); + break; + } + case 26: { + Mac = input.ReadString(); + break; + } + case 34: { + EndPoint = input.ReadString(); + break; + } + case 42: { + Version = input.ReadString(); + break; + } + case 48: { + IsTakeCard = input.ReadBool(); + break; + } + case 57: { + V = input.ReadDouble(); + break; + } + case 65: { + A = input.ReadDouble(); + break; + } + case 73: { + P = input.ReadDouble(); + break; + } + case 81: { + KWH = input.ReadDouble(); + break; + } + case 89: { + SumKWH = input.ReadDouble(); + break; + } + case 96: { + CreateTime = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/ConsoleApp2/EnergyConsumption.proto b/ConsoleApp2/EnergyConsumption.proto new file mode 100644 index 0000000..e667055 --- /dev/null +++ b/ConsoleApp2/EnergyConsumption.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package BLWData.Entity; + +// 定义一个Person消息类型 +message EnergyConsumption { + int64 HotelCode = 1; + string HostNumber = 2; + string Mac = 3; + string EndPoint = 4; + string Version = 5; + bool IsTakeCard = 6; + double V = 7; + double A = 8; + double P = 9; + double KW_H = 10; + double Sum_KW_H = 11; + int64 CreateTime=12; +} \ No newline at end of file diff --git a/ConsoleApp2/Program.cs b/ConsoleApp2/Program.cs new file mode 100644 index 0000000..a9878f5 --- /dev/null +++ b/ConsoleApp2/Program.cs @@ -0,0 +1,120 @@ +using System.Net.WebSockets; +using System.Text; +using System.Text.Json; +using BLWData.Entity; +using CommonEntity; +using CommonTools; +using MessagePack; +using Microsoft.FSharp.Collections; + +namespace ConsoleApp2 +{ + internal class Program + { + static void Main(string[] args) + { + + string afds = "hello"; + string dda = afds; + dda = "world"; + Console.WriteLine(afds); + + string YYY = File.ReadAllText("3.txt"); + NengHao? poo = System.Text.Json.JsonSerializer.Deserialize(YYY); + byte[] qf = MyMessagePacker.FastSerialize(poo); + + + ////宝镜系统使用 + //EnergyConsumption ese = new EnergyConsumption(); + //ese.HotelCode = poo.HotelCode; + //ese.HostNumber = poo.HostNumber; + //ese.Mac = poo.Mac; + //ese.EndPoint = poo.EndPoint; + //ese.V = poo.V; + //ese.A = poo.A; + //ese.P = poo.P; + //ese.KWH = poo.KW_H; + //ese.SumKWH = poo.Sum_KW_H; + //ese.CreateTime = poo.CreateTime; + //ese.IsTakeCard = poo.IsTakeCard; + //ese.RoomNumber = poo.RoomNumber; + //ese.CarbonVIP = poo.CarbonVIP; + + //byte[] data = ese.ToByteArray(); + //string TopicKey1 = KafkaKey.BLWLog4BaoJing_RCU_Topic; + //string DetailKey1 = KafkaKey.UDPPackageWholeDataMonitor; + string[] NNN = "34-D0-B8-11-80-80".Split('-'); + string n1 = NNN[4]; + string n2 = NNN[5]; + byte bbn1 = Convert.ToByte(n1, 16); + byte bbn2 = Convert.ToByte(n2, 16); + short MAC1 = Convert.ToInt16(bbn1); + short MAC2 = Convert.ToInt16(bbn2); + string HOSTNUMBER = "099008" + MAC1 + MAC2; + + string nnn = File.ReadAllText("1.txt"); + UDPPackage? usa = JsonSerializer.Deserialize(nnn); + AAA a = new AAA(); + MyClass mm = new MyClass(); + mm.Age = 30; + mm.FirstName = "Test"; + mm.LastName = "我是一从此非常大霏霏 的数据"; + a.MyClass = new List { mm }; + var asd = System.Text.Json.JsonSerializer.Serialize(a); + + var qqfa = Encoding.UTF8.GetBytes(asd.ToString()); + + //byte[] qf = MyMessagePacker.FastSerialize(mm); + string uuu = MyMessagePacker.FastDeserialize(qf); + AAA uuu111 = MyMessagePacker.FastDeserialize(qf); + //Console.WriteLine(uuu.MyClass.FirstOrDefault().FirstName); + + FSharpList b = ListModule.OfArray(new byte[] { 0x01, 0x02, 0x03 }); + FSharpList b1 = ListModule.OfArray(new byte[] { 0x01, 0x02, 0x03 }); + bool bf = fv.check(b, b1); + Console.WriteLine(bf); + Console.WriteLine("Hello, World!"); + } + public static void google_parse() + { + EnergyConsumption e = new EnergyConsumption(); + + byte[] bbb = new byte[] { }; + e = EnergyConsumption.Parser.ParseFrom(bbb); + + } + } + + [MessagePackObject] + public class ItsClass + { + [Key(0)] + public string Data { get; set; } + } + [MessagePackObject] + public class MyClass + { + // Key attributes take a serialization index (or string name) + // The values must be unique and versioning has to be considered as well. + // Keys are described in later sections in more detail. + [Key(0)] + public int Age { get; set; } + + [Key(1)] + public string FirstName { get; set; } + + [Key(2)] + public string LastName { get; set; } + + // All fields or properties that should not be serialized must be annotated with [IgnoreMember]. + [IgnoreMember] + public string FullName { get { return FirstName + LastName; } } + } + [MessagePackObject()] + public class AAA + { + [Key(0)] + public List MyClass { get; set; } + + } +} diff --git a/ConsoleApp2/Properties/PublishProfiles/FolderProfile.pubxml b/ConsoleApp2/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..49eb151 --- /dev/null +++ b/ConsoleApp2/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,18 @@ + + + + + Release + Any CPU + bin\Release\net8.0\publish\win-x64\ + FileSystem + <_TargetId>Folder + net8.0 + win-x64 + false + true + false + + \ No newline at end of file diff --git a/ConsoleApp2/Properties/PublishProfiles/FolderProfile.pubxml.user b/ConsoleApp2/Properties/PublishProfiles/FolderProfile.pubxml.user new file mode 100644 index 0000000..9f076b1 --- /dev/null +++ b/ConsoleApp2/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -0,0 +1,10 @@ + + + + + False|2025-08-21T03:00:43.6781283Z||;False|2025-08-21T11:00:12.0221678+08:00||;False|2025-08-21T11:00:02.1990936+08:00||;False|2025-08-21T10:59:34.6009353+08:00||; + + + \ No newline at end of file diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj new file mode 100644 index 0000000..146a56a --- /dev/null +++ b/DAL/DAL.csproj @@ -0,0 +1,29 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/DAL/New_Models/DevMonitorLog.cs b/DAL/New_Models/DevMonitorLog.cs new file mode 100644 index 0000000..fea5195 --- /dev/null +++ b/DAL/New_Models/DevMonitorLog.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class DevMonitorLog +{ + public long Id { get; set; } + + public int? HostId { get; set; } + + public int? HotelId { get; set; } + + public string? RoomNo { get; set; } + + public string? Ip { get; set; } + + public string? Mac { get; set; } + + public string? CommandType { get; set; } + + public string? SendOrReceive { get; set; } + + public string? Data { get; set; } + + public string? CreateTime { get; set; } +} diff --git a/DAL/New_Models/EcoDetail.cs b/DAL/New_Models/EcoDetail.cs new file mode 100644 index 0000000..b57b60e --- /dev/null +++ b/DAL/New_Models/EcoDetail.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class EcoDetail +{ + public int Id { get; set; } + + public int? HotelId { get; set; } + + public int? HostId { get; set; } + + public string? RoomNo { get; set; } + + public string? TriggerTime { get; set; } + + public int? EcoId { get; set; } + + public bool? IsTrigger { get; set; } +} diff --git a/DAL/New_Models/EcoSetting.cs b/DAL/New_Models/EcoSetting.cs new file mode 100644 index 0000000..1e64d7c --- /dev/null +++ b/DAL/New_Models/EcoSetting.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class EcoSetting +{ + public int Id { get; set; } + + public string? StartTime { get; set; } + + public string? EndTime { get; set; } + + public int? HostId { get; set; } + + public int? HotelId { get; set; } + + public string? RoomNo { get; set; } + + public string? CreateTime { get; set; } + + public string? AddOrCutDown { get; set; } + + public int? ActValue { get; set; } + + public bool? IsEnable { get; set; } +} diff --git a/DAL/New_Models/KongTiaoTimer.cs b/DAL/New_Models/KongTiaoTimer.cs new file mode 100644 index 0000000..4de8c18 --- /dev/null +++ b/DAL/New_Models/KongTiaoTimer.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class KongTiaoTimer +{ + public int Id { get; set; } + + public int? HotelId { get; set; } + + public string? HotelCode { get; set; } + + public int? HostId { get; set; } + + public string? RoomNo { get; set; } + + public string MissonKey { get; set; } = null!; + + public int? IsCancel { get; set; } + + public string? StartTime { get; set; } + + public string? EndTime { get; set; } + + public string? CreateTime { get; set; } + + public string? CreateDate { get; set; } +} diff --git a/DAL/New_Models/LieEco.cs b/DAL/New_Models/LieEco.cs new file mode 100644 index 0000000..33dfc96 --- /dev/null +++ b/DAL/New_Models/LieEco.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class LieEco +{ + public int Id { get; set; } + + public string? StartTime { get; set; } + + public string? EndTime { get; set; } + + public bool? AbsEnable { get; set; } + + public int? AbsValue { get; set; } + + public bool? RelativeEnable { get; set; } + + public int? RelativeValue { get; set; } + + public int? DelayTime { get; set; } + + public bool? IsEnable { get; set; } + + public string? HotelCode { get; set; } + + public int? HotelId { get; set; } + + public DateTime? CreateTime { get; set; } +} diff --git a/DAL/New_Models/RegisterLog.cs b/DAL/New_Models/RegisterLog.cs new file mode 100644 index 0000000..19690e5 --- /dev/null +++ b/DAL/New_Models/RegisterLog.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class RegisterLog +{ + public int Id { get; set; } + + public int? HostId { get; set; } + + public string? HotelCode { get; set; } + + public string? Mac { get; set; } + + public string? CreateTime { get; set; } +} diff --git a/DAL/New_Models/RicsContext.cs b/DAL/New_Models/RicsContext.cs new file mode 100644 index 0000000..fdf62d2 --- /dev/null +++ b/DAL/New_Models/RicsContext.cs @@ -0,0 +1,2477 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; + +namespace DAL.New_Models; + +public partial class RicsContext : DbContext +{ + public RicsContext() + { + } + + public RicsContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet DevMonitorLogs { get; set; } + + public virtual DbSet EcoDetails { get; set; } + + public virtual DbSet EcoSettings { get; set; } + + public virtual DbSet KongTiaoTimers { get; set; } + + public virtual DbSet LieEcos { get; set; } + + public virtual DbSet RegisterLogs { get; set; } + + public virtual DbSet RoomNoBodyHowToLogs { get; set; } + + public virtual DbSet RoomNobodyHowTos { get; set; } + + public virtual DbSet SmartRobotDisableTimes { get; set; } + + public virtual DbSet TbAlarmSettings { get; set; } + + public virtual DbSet TbAppHotels { get; set; } + + public virtual DbSet TbAppMenus { get; set; } + + public virtual DbSet TbAppRooms { get; set; } + + public virtual DbSet TbCarbonStatuses { get; set; } + + public virtual DbSet TbFaultRecords { get; set; } + + public virtual DbSet TbFaultTypes { get; set; } + + public virtual DbSet TbGroups { get; set; } + + public virtual DbSet TbHosts { get; set; } + + public virtual DbSet TbHostAirs { get; set; } + + public virtual DbSet TbHostAirRecords { get; set; } + + public virtual DbSet TbHostFaults { get; set; } + + public virtual DbSet TbHostFaultRecords { get; set; } + + public virtual DbSet TbHostModals { get; set; } + + public virtual DbSet TbHostModalEnergies { get; set; } + + public virtual DbSet TbHostModalRecords { get; set; } + + public virtual DbSet TbHostModalRecordsBaks { get; set; } + + public virtual DbSet TbHostRoomCards { get; set; } + + public virtual DbSet TbHostScenes { get; set; } + + public virtual DbSet TbHostTimingControls { get; set; } + + public virtual DbSet TbHostUpdates { get; set; } + + public virtual DbSet TbHostUpdateStatuses { get; set; } + + public virtual DbSet TbHostWordsReports { get; set; } + + public virtual DbSet TbHostsRcus { get; set; } + + public virtual DbSet TbHotelAirControls { get; set; } + + public virtual DbSet TbHotelSeasons { get; set; } + + public virtual DbSet TbManualVisits { get; set; } + + public virtual DbSet TbModalTypes { get; set; } + + public virtual DbSet TbModels { get; set; } + + public virtual DbSet TbModelDetails { get; set; } + + public virtual DbSet TbRoomCards { get; set; } + + public virtual DbSet TbRoomCardTypes { get; set; } + + public virtual DbSet TbRoomModals { get; set; } + + public virtual DbSet TbRoomModalTypes { get; set; } + + public virtual DbSet TbRoomServices { get; set; } + + public virtual DbSet TbRoomServiceRecords { get; set; } + + public virtual DbSet TbRoomStatuses { get; set; } + + public virtual DbSet TbRoomStatusAids { get; set; } + + public virtual DbSet TbRoomTypes { get; set; } + + public virtual DbSet TbRoomTypeAirs { get; set; } + + public virtual DbSet TbRoomTypeChannels { get; set; } + + public virtual DbSet TbRoomTypeModals { get; set; } + + public virtual DbSet TbRoomTypeProgramFiles { get; set; } + + public virtual DbSet TbRoomTypeScenes { get; set; } + + public virtual DbSet TbRoomTypeSceneModals { get; set; } + + public virtual DbSet TbRoomTypeWxmenus { get; set; } + + public virtual DbSet TbSeasons { get; set; } + + public virtual DbSet TbSysActiveUsers { get; set; } + + public virtual DbSet TbSysAuthorities { get; set; } + + public virtual DbSet TbSysCities { get; set; } + + public virtual DbSet TbSysCounties { get; set; } + + public virtual DbSet TbSysDistricts { get; set; } + + public virtual DbSet TbSysHotels { get; set; } + + public virtual DbSet TbSysHotelGroups { get; set; } + + public virtual DbSet TbSysOauth2s { get; set; } + + public virtual DbSet TbSysPositions { get; set; } + + public virtual DbSet TbSysProvinces { get; set; } + + public virtual DbSet TbSysRoles { get; set; } + + public virtual DbSet TbSysSeeks { get; set; } + + public virtual DbSet TbSysSettings { get; set; } + + public virtual DbSet TbSysSystemLogs { get; set; } + + public virtual DbSet TbSysUsers { get; set; } + + public virtual DbSet TbWxmenus { get; set; } + + public virtual DbSet TbWxmessages { get; set; } + + public virtual DbSet TblSyncLists { get; set; } + + public virtual DbSet Tests { get; set; } + + public virtual DbSet TftpSets { get; set; } + + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_dev_MonitorData"); + + entity.ToTable("dev_MonitorLog"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CommandType).HasMaxLength(64); + entity.Property(e => e.CreateTime).HasMaxLength(255); + entity.Property(e => e.Data).HasMaxLength(256); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Ip) + .HasMaxLength(64) + .HasColumnName("IP"); + entity.Property(e => e.Mac) + .HasMaxLength(64) + .HasColumnName("MAC"); + entity.Property(e => e.RoomNo).HasMaxLength(64); + entity.Property(e => e.SendOrReceive).HasMaxLength(64); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("ECO_Detail"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.EcoId).HasColumnName("ECO_ID"); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.RoomNo).HasMaxLength(64); + entity.Property(e => e.TriggerTime).HasMaxLength(50); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("ECO_Setting"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.AddOrCutDown).HasMaxLength(50); + entity.Property(e => e.CreateTime).HasMaxLength(64); + entity.Property(e => e.EndTime).HasMaxLength(64); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.RoomNo).HasMaxLength(50); + entity.Property(e => e.StartTime).HasMaxLength(64); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_KongTiaoTimer_1"); + + entity.ToTable("KongTiaoTimer"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CreateDate).HasMaxLength(64); + entity.Property(e => e.CreateTime).HasMaxLength(64); + entity.Property(e => e.EndTime).HasMaxLength(64); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.HotelCode).HasMaxLength(64); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.MissonKey).HasMaxLength(64); + entity.Property(e => e.RoomNo).HasMaxLength(64); + entity.Property(e => e.StartTime).HasMaxLength(64); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("LieECO"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CreateTime).HasColumnType("datetime"); + entity.Property(e => e.EndTime) + .HasMaxLength(32) + .IsUnicode(false); + entity.Property(e => e.HotelCode).HasMaxLength(32); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.StartTime) + .HasMaxLength(32) + .IsUnicode(false); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("RegisterLog"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CreateTime).HasMaxLength(64); + entity.Property(e => e.HostId).HasColumnName("Host_ID"); + entity.Property(e => e.HotelCode) + .HasMaxLength(64) + .HasColumnName("Hotel_Code"); + entity.Property(e => e.Mac).HasMaxLength(64); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("RoomNoBodyHowTo_Log"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CreateTime).HasMaxLength(64); + entity.Property(e => e.MissionKey).HasMaxLength(64); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_NobodyHowTo"); + + entity.ToTable("RoomNobodyHowTo"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CreateTime).HasMaxLength(64); + entity.Property(e => e.CurrentHotelId).HasColumnName("CurrentHotelID"); + entity.Property(e => e.How).HasMaxLength(64); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("SmartRobotDisableTime"); + + entity.Property(e => e.CreateTime).HasMaxLength(64); + entity.Property(e => e.DisableEtime) + .HasMaxLength(64) + .HasColumnName("DisableETime"); + entity.Property(e => e.DisableStime) + .HasMaxLength(64) + .HasColumnName("DisableSTime"); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.HotelCode).HasMaxLength(64); + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.IsTrigger).HasMaxLength(255); + entity.Property(e => e.RoomNumber).HasMaxLength(64); + entity.Property(e => e.TargetDomain).HasMaxLength(255); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.HotelId, e.Type, e.Code }).HasName("PK_tb_AalarmSetting"); + + entity.ToTable("tb_AlarmSetting"); + + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Type) + .HasMaxLength(1) + .IsUnicode(false) + .IsFixedLength(); + entity.Property(e => e.Code) + .HasMaxLength(20) + .IsUnicode(false); + entity.Property(e => e.AppApply) + .HasDefaultValue(false) + .HasComment("是否移动端上应用"); + entity.Property(e => e.Beep) + .HasDefaultValue(false) + .HasComment("声音提示"); + entity.Property(e => e.Color) + .HasMaxLength(10) + .IsUnicode(false); + entity.Property(e => e.Ename) + .HasMaxLength(50) + .HasColumnName("EName"); + entity.Property(e => e.ModalTypeId).HasColumnName("ModalTypeID"); + entity.Property(e => e.Name).HasMaxLength(50); + entity.Property(e => e.Sort).HasDefaultValue(1); + entity.Property(e => e.Value) + .HasMaxLength(20) + .HasDefaultValueSql("((0))"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Code); + + entity.ToTable("tb_AppHotel"); + + entity.Property(e => e.Code) + .HasMaxLength(10) + .IsUnicode(false); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Remark).HasMaxLength(50); + entity.Property(e => e.Sort).HasDefaultValue(1); + entity.Property(e => e.Value).HasMaxLength(4000); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_AppMenus"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.ActiveIndicator) + .HasDefaultValue(true) + .HasComment("启用"); + entity.Property(e => e.Class) + .HasMaxLength(30) + .IsUnicode(false); + entity.Property(e => e.Code) + .HasMaxLength(10) + .IsUnicode(false); + entity.Property(e => e.EnglishName) + .HasMaxLength(50) + .IsUnicode(false); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Icon).HasMaxLength(500); + entity.Property(e => e.Name) + .HasMaxLength(50) + .HasComment("关联菜单ID"); + entity.Property(e => e.Sort) + .HasDefaultValue(1) + .HasComment("排序"); + entity.Property(e => e.Url).HasMaxLength(100); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_AppRoom"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Mac) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("app mac地址") + .HasColumnName("MAC"); + entity.Property(e => e.RoomNumber) + .HasMaxLength(20) + .HasComment("房号"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_CarbonStatus"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CreateTime).HasColumnType("datetime"); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.Status).HasMaxLength(64); + entity.Property(e => e.TriggerSource).HasMaxLength(64); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_FaultRecords"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CancelPerson) + .HasMaxLength(20) + .HasComment("注销人"); + entity.Property(e => e.CancelReason) + .HasMaxLength(100) + .HasComment("注销原因"); + entity.Property(e => e.CancelTime) + .HasComment("注销时间") + .HasColumnType("datetime"); + entity.Property(e => e.Description) + .HasMaxLength(100) + .HasComment("故障描述"); + entity.Property(e => e.FaultTime) + .HasComment("故障发生时间") + .HasColumnType("datetime"); + entity.Property(e => e.FaultTypeId) + .HasComment("故障类别ID") + .HasColumnName("FaultTypeID"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.IsCancel) + .HasDefaultValue(false) + .HasComment("注销:1已注销"); + entity.Property(e => e.Number) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("故障编号"); + entity.Property(e => e.RegisteredPerson) + .HasMaxLength(20) + .HasComment("登记人"); + entity.Property(e => e.RegisteredTime) + .HasComment("登记时间") + .HasColumnType("datetime"); + entity.Property(e => e.RepairContent) + .HasMaxLength(100) + .HasComment("维修内容"); + entity.Property(e => e.RepairPerson) + .HasMaxLength(20) + .HasComment("维修人"); + entity.Property(e => e.RepairTime) + .HasComment("维修时间") + .HasColumnType("datetime"); + entity.Property(e => e.RoomNumber) + .HasMaxLength(20) + .HasComment("房号"); + entity.Property(e => e.Status) + .HasDefaultValue(0) + .HasComment("维修状态:0未维修,1已维修"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_FaultType"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Code) + .HasMaxLength(20) + .HasComment("故障编号"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Name) + .HasMaxLength(50) + .HasComment("故障名称"); + entity.Property(e => e.Remark) + .HasMaxLength(200) + .HasComment("故障说明"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_Groups"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Name).HasMaxLength(50); + entity.Property(e => e.ParentId) + .HasDefaultValue(0) + .HasColumnName("ParentID"); + entity.Property(e => e.Sort).HasDefaultValue(1); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_tb_RCUHosts"); + + entity.ToTable("tb_Hosts"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.ConfigVersion).HasMaxLength(200); + entity.Property(e => e.DeviceName) + .HasMaxLength(20) + .IsUnicode(false); + entity.Property(e => e.DeviceSecret) + .HasMaxLength(32) + .IsUnicode(false); + entity.Property(e => e.DisableEndTime) + .HasMaxLength(64) + .IsUnicode(false) + .HasDefaultValue("08:00"); + entity.Property(e => e.DisableStartTime) + .HasMaxLength(64) + .IsUnicode(false) + .HasDefaultValue("23:00"); + entity.Property(e => e.Dns) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("DNS"); + entity.Property(e => e.DoorLockStatus) + .HasDefaultValue(false) + .HasComment("门锁"); + entity.Property(e => e.DoorLockStatusUpdateTime).HasColumnType("datetime"); + entity.Property(e => e.ExpireTime).HasColumnType("datetime"); + entity.Property(e => e.FcsLocationUuid) + .HasMaxLength(128) + .HasColumnName("FCS_locationUUID"); + entity.Property(e => e.FrameNoTime).HasColumnType("datetime"); + entity.Property(e => e.Gateway) + .HasMaxLength(15) + .IsUnicode(false) + .HasDefaultValue("") + .HasComment("默认网关"); + entity.Property(e => e.GroupId) + .HasComment("所属楼层") + .HasColumnName("GroupID"); + entity.Property(e => e.HiWeiCuid) + .HasMaxLength(128) + .HasColumnName("HiWeiCUID"); + entity.Property(e => e.HostNumber) + .HasMaxLength(20) + .HasComment("主机编号"); + entity.Property(e => e.HostSecret) + .HasMaxLength(32) + .IsUnicode(false); + entity.Property(e => e.HostTemp).HasDefaultValue((short)0); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.HuaWeiCuid) + .HasMaxLength(255) + .HasColumnName("HuaWeiCUID"); + entity.Property(e => e.IotId) + .HasMaxLength(32) + .IsUnicode(false); + entity.Property(e => e.Ip) + .HasMaxLength(15) + .IsUnicode(false) + .HasColumnName("IP"); + entity.Property(e => e.Iptype).HasColumnName("IPType"); + entity.Property(e => e.IsWelcomeDisableTime).HasDefaultValue(false); + entity.Property(e => e.LanIp) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("LanIP"); + entity.Property(e => e.LastModifiedTime) + .HasColumnType("datetime") + .HasColumnName("Last_Modified_Time"); + entity.Property(e => e.LauncherVersion).HasMaxLength(200); + entity.Property(e => e.Mac) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("MAC"); + entity.Property(e => e.MacbindDate) + .HasColumnType("datetime") + .HasColumnName("MACBindDate"); + entity.Property(e => e.Model).HasMaxLength(200); + entity.Property(e => e.Port) + .HasDefaultValue(3341) + .HasComment("端口"); + entity.Property(e => e.ProductKey) + .HasMaxLength(20) + .IsUnicode(false); + entity.Property(e => e.RegisterDate) + .HasComment("注册日期") + .HasColumnType("datetime"); + entity.Property(e => e.Remark) + .HasMaxLength(200) + .HasDefaultValue("") + .HasComment("备注"); + entity.Property(e => e.RokidWebhookUrl) + .HasMaxLength(200) + .IsUnicode(false); + entity.Property(e => e.RoomCardId) + .HasDefaultValue(1001) + .HasComment("身份") + .HasColumnName("RoomCardID"); + entity.Property(e => e.RoomNumber) + .HasMaxLength(20) + .HasComment("房间号"); + entity.Property(e => e.RoomStatusId) + .HasDefaultValue(1001) + .HasComment("房态") + .HasColumnName("RoomStatusID"); + entity.Property(e => e.RoomTypeId) + .HasComment("房型") + .HasColumnName("RoomTypeID"); + entity.Property(e => e.RunTime).HasColumnType("datetime"); + entity.Property(e => e.SafeStatus) + .HasDefaultValue(2) + .HasComment("保险箱:0关,1开,2未接保险箱"); + entity.Property(e => e.Season).HasMaxLength(255); + entity.Property(e => e.ServerIp) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("ServerIP"); + entity.Property(e => e.SetExpireTime).HasColumnType("datetime"); + entity.Property(e => e.Status) + .HasDefaultValue(false) + .HasComment("状态 0:离线 1:在线"); + entity.Property(e => e.SubnetMask) + .HasMaxLength(15) + .IsUnicode(false) + .HasDefaultValue("") + .HasComment("子网掩码"); + entity.Property(e => e.Tclcuid) + .HasMaxLength(255) + .HasColumnName("TCLCUID"); + entity.Property(e => e.TclskillId) + .HasMaxLength(64) + .IsUnicode(false) + .HasColumnName("TCLSkillID"); + entity.Property(e => e.TianMaoCuid) + .HasMaxLength(255) + .HasColumnName("TianMaoCUID"); + entity.Property(e => e.UpgradeTime).HasColumnType("datetime"); + entity.Property(e => e.Version) + .HasMaxLength(50) + .IsUnicode(false) + .HasDefaultValue("") + .HasComment("版本号"); + entity.Property(e => e.Wxvalidate) + .HasMaxLength(200) + .HasColumnName("WXValidate"); + entity.Property(e => e.XiaoDuCuid) + .HasMaxLength(255) + .HasColumnName("XiaoDuCUID"); + entity.Property(e => e.XiaoMiCuid) + .HasMaxLength(255) + .HasColumnName("XiaoMiCUID"); + + entity.HasOne(d => d.Group).WithMany(p => p.TbHosts) + .HasForeignKey(d => d.GroupId) + .HasConstraintName("FK_tb_Hosts_tb_Groups"); + + entity.HasOne(d => d.Hotel).WithMany(p => p.TbHosts) + .HasForeignKey(d => d.HotelId) + .HasConstraintName("FK_tb_Hosts_tb_Sys_Hotels"); + + entity.HasOne(d => d.RoomCard).WithMany(p => p.TbHosts) + .HasForeignKey(d => d.RoomCardId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("FK_tb_Hosts_tb_RoomCard"); + + entity.HasOne(d => d.RoomStatus).WithMany(p => p.TbHosts) + .HasForeignKey(d => d.RoomStatusId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("FK_tb_Hosts_tb_RoomStatus"); + + entity.HasOne(d => d.RoomType).WithMany(p => p.TbHosts) + .HasForeignKey(d => d.RoomTypeId) + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("FK_tb_Hosts_tb_RoomType"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.HostId, e.RoomTypeAirId }).HasName("PK_tb_HostAirStatus"); + + entity.ToTable("tb_HostAir"); + + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.RoomTypeAirId).HasColumnName("RoomTypeAirID"); + entity.Property(e => e.ColdDevition) + .HasDefaultValue((short)2) + .HasComment("冷偏差"); + entity.Property(e => e.ColdHotMode) + .HasDefaultValue(0) + .HasComment("冷热模式:0/手动,1/自动"); + entity.Property(e => e.ColdHotSwitchDelayTime) + .HasDefaultValue(30) + .HasComment("冷热转换延时,单位:秒"); + entity.Property(e => e.ColdValve) + .HasDefaultValue((short)0) + .HasComment("冷阀门:0关,1开"); + entity.Property(e => e.CompensatoryTemp) + .HasDefaultValue(0.0) + .HasComment("补偿温度"); + entity.Property(e => e.ControlType) + .HasDefaultValue(0) + .HasComment("空调管制:0/二管制,1/四管制"); + entity.Property(e => e.CurrentTemp) + .HasDefaultValue((short)0) + .HasComment("当前温度"); + entity.Property(e => e.DeadTemp) + .HasDefaultValue((short)2) + .HasComment("死区温度"); + entity.Property(e => e.DisableFanHighSpeed) + .HasDefaultValue(false) + .HasComment("禁止风机高速运行:0/否,1/是"); + entity.Property(e => e.FanStop) + .HasDefaultValue(false) + .HasComment("温度到达停止风机运行"); + entity.Property(e => e.HightTemp) + .HasDefaultValue((short)33) + .HasComment("最高温度"); + entity.Property(e => e.HotDevition) + .HasDefaultValue((short)2) + .HasComment("热"); + entity.Property(e => e.InitTemp) + .HasDefaultValue((short)22) + .HasComment("初始温度"); + entity.Property(e => e.IsLockTemp) + .HasDefaultValue(false) + .HasComment("是否锁定温度"); + entity.Property(e => e.KeepTemp) + .HasDefaultValue((short)22) + .HasComment("保温温度"); + entity.Property(e => e.LockTemp) + .HasDefaultValue((short)0) + .HasComment("锁定温度"); + entity.Property(e => e.LowerTemp) + .HasDefaultValue((short)16) + .HasComment("最低温度"); + entity.Property(e => e.ModalId) + .HasMaxLength(255) + .HasColumnName("ModalID"); + entity.Property(e => e.Mode) + .HasDefaultValue(0) + .HasComment("模式: 1/制冷模式,2/制热模式,4/送风模式,8/除湿模式"); + entity.Property(e => e.RelateDoorContact) + .HasDefaultValue(false) + .HasComment("是否关联门磁"); + entity.Property(e => e.RelateRoomStatus) + .HasDefaultValue(true) + .HasComment("是否关联房态"); + entity.Property(e => e.RoomTypeModalId).HasColumnName("RoomTypeModalID"); + entity.Property(e => e.Running) + .HasDefaultValue(false) + .HasComment("空调运行状态,0/停止,1/运行"); + entity.Property(e => e.SettingTemp) + .HasDefaultValue((short)22) + .HasComment("设定温度"); + entity.Property(e => e.SleepColdDevition).HasComment("睡眠冷偏差"); + entity.Property(e => e.SleepDevition) + .HasDefaultValue((short)0) + .HasComment("睡眠模式偏差"); + entity.Property(e => e.SleepEndTime) + .HasMaxLength(5) + .IsUnicode(false) + .HasComment("睡眠结束时间"); + entity.Property(e => e.SleepFlag) + .HasDefaultValue(false) + .HasComment("启用睡眠标志"); + entity.Property(e => e.SleepHotDevition).HasComment("睡眠热"); + entity.Property(e => e.SleepStartTime) + .HasMaxLength(5) + .IsUnicode(false) + .HasComment("睡眠开始时间"); + entity.Property(e => e.Speed) + .HasDefaultValue((short)0) + .HasComment("风速:0/停止, 1/低速, 2/中速, 3/高速, 4/自动"); + entity.Property(e => e.ThermalValve) + .HasDefaultValue((short)0) + .HasComment("热阀门:0关,1开"); + entity.Property(e => e.TimeEndTime1) + .HasMaxLength(5) + .IsUnicode(false) + .HasComment("定时结束时间1"); + entity.Property(e => e.TimeEndTime2) + .HasMaxLength(5) + .IsUnicode(false) + .HasComment("定时结束时间2"); + entity.Property(e => e.TimeEndTime3) + .HasMaxLength(5) + .IsUnicode(false) + .HasComment("定时结束时间3"); + entity.Property(e => e.TimeFlag) + .HasDefaultValue(false) + .HasComment("启动定时"); + entity.Property(e => e.TimeStartTime1) + .HasMaxLength(5) + .IsUnicode(false) + .HasComment("定时开始时间1"); + entity.Property(e => e.TimeStartTime2) + .HasMaxLength(5) + .IsUnicode(false) + .HasComment("定时开始时间2"); + entity.Property(e => e.TimeStartTime3) + .HasMaxLength(5) + .IsUnicode(false) + .HasComment("定时开始时间3"); + entity.Property(e => e.Valve) + .HasDefaultValue(0) + .HasComment("阀状态: 0/冷阀开,1/冷阀关,2/热阀开,3/热阀关"); + entity.Property(e => e.WelcomeTime) + .HasDefaultValue((short)30) + .HasComment("欢迎模式时间(分钟)"); + + entity.HasOne(d => d.RoomTypeAir).WithMany(p => p.TbHostAirs) + .HasForeignKey(d => d.RoomTypeAirId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_tb_HostAir_tb_RoomTypeAir"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_HostAirRecords"); + + entity.Property(e => e.Id) + .HasComment("ID") + .HasColumnName("ID"); + entity.Property(e => e.AirNo).HasComment("空调序号"); + entity.Property(e => e.EndTime) + .HasComment("结束时间") + .HasColumnType("datetime"); + entity.Property(e => e.HostId) + .HasComment("主机ID") + .HasColumnName("HostID"); + entity.Property(e => e.RoomNumber) + .HasMaxLength(20) + .HasDefaultValue("") + .HasComment("房号"); + entity.Property(e => e.StartTime) + .HasComment("开始时间") + .HasColumnType("datetime"); + entity.Property(e => e.Temp).HasComment("温度值"); + entity.Property(e => e.TempType).HasComment("温度类型"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_HostFaults"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Abnormal3Date).HasColumnType("datetime"); + entity.Property(e => e.Abnormal4Date).HasColumnType("datetime"); + entity.Property(e => e.Abnormal5Date).HasColumnType("datetime"); + entity.Property(e => e.Address) + .HasMaxLength(20) + .IsUnicode(false); + entity.Property(e => e.ElectricQtyDate).HasColumnType("datetime"); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.StatusDate).HasColumnType("datetime"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__tb_HostF__3214EC27696855F0"); + + entity.ToTable("tb_HostFaultRecords"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Date).HasColumnType("datetime"); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.ModalAddress).HasMaxLength(25); + entity.Property(e => e.RoomNumber).HasMaxLength(25); + entity.Property(e => e.RoomTypeId).HasColumnName("RoomTypeID"); + entity.Property(e => e.RoomTypeModalId).HasColumnName("RoomTypeModalID"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.HostId, e.RoomTypeModalId }); + + entity.ToTable("tb_HostModal"); + + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.RoomTypeModalId).HasColumnName("RoomTypeModalID"); + entity.Property(e => e.Brightness).HasComment("亮度"); + entity.Property(e => e.Status).HasComment("状态:0关,1开"); + entity.Property(e => e.Time).HasComment("当天开启时长"); + entity.Property(e => e.UpdateTime).HasColumnType("datetime"); + + entity.HasOne(d => d.RoomTypeModal).WithMany(p => p.TbHostModals) + .HasForeignKey(d => d.RoomTypeModalId) + .HasConstraintName("FK_tb_HostModal_tb_RoomTypeModal"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_HostModalEnergy"); + + entity.Property(e => e.Date).HasComment("时间"); + entity.Property(e => e.Energy).HasComment("消耗能量"); + entity.Property(e => e.HostId) + .HasComment("主机ID") + .HasColumnName("HostID"); + entity.Property(e => e.ModalAddress) + .HasMaxLength(20) + .IsUnicode(false); + entity.Property(e => e.Outlet) + .HasMaxLength(10) + .IsUnicode(false) + .HasDefaultValue(""); + entity.Property(e => e.RoomNumber) + .HasMaxLength(20) + .HasComment("房号"); + entity.Property(e => e.RoomTypeId).HasColumnName("RoomTypeID"); + entity.Property(e => e.RoomTypeModalId) + .HasComment("回路ID") + .HasColumnName("RoomTypeModalID"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_HostModalRecords"); + + entity.Property(e => e.Id) + .HasComment("ID") + .HasColumnName("ID"); + entity.Property(e => e.EndTime).HasColumnType("datetime"); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.ModalAddress) + .HasMaxLength(20) + .IsUnicode(false); + entity.Property(e => e.RoomNumber).HasMaxLength(20); + entity.Property(e => e.RoomTypeId).HasColumnName("RoomTypeID"); + entity.Property(e => e.RoomTypeModalId).HasColumnName("RoomTypeModalID"); + entity.Property(e => e.StartTime).HasColumnType("datetime"); + + entity.HasOne(d => d.RoomTypeModal).WithMany(p => p.TbHostModalRecords) + .HasForeignKey(d => d.RoomTypeModalId) + .HasConstraintName("FK_tb_HostModalRecords_tb_RoomTypeModal"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_HostModalRecords_bak"); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasColumnName("ID"); + entity.Property(e => e.EndTime).HasColumnType("datetime"); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.ModalAddress) + .HasMaxLength(20) + .IsUnicode(false); + entity.Property(e => e.RoomNumber).HasMaxLength(20); + entity.Property(e => e.RoomTypeId).HasColumnName("RoomTypeID"); + entity.Property(e => e.RoomTypeModalId).HasColumnName("RoomTypeModalID"); + entity.Property(e => e.StartTime).HasColumnType("datetime"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_HostRoomCard"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CardNumber) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("房卡编号"); + entity.Property(e => e.CardTypeId) + .HasComment("房卡类型ID") + .HasColumnName("CardTypeID"); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.InCardTime).HasColumnType("datetime"); + entity.Property(e => e.IsAlarm).HasDefaultValue(false); + entity.Property(e => e.OutCardTime).HasColumnType("datetime"); + entity.Property(e => e.RoomCardId).HasColumnName("RoomCardID"); + entity.Property(e => e.RoomNumber).HasMaxLength(20); + entity.Property(e => e.UserName) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("员工姓名"); + entity.Property(e => e.UserNumber) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("员工编号"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.HostId, e.RoomTypeSceneId }).HasName("PK__tb_HostS__F27277C1AE11321C"); + + entity.ToTable("tb_HostScene"); + + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.RoomTypeSceneId).HasColumnName("RoomTypeSceneID"); + entity.Property(e => e.UpdateTime).HasColumnType("datetime"); + + entity.HasOne(d => d.RoomTypeScene).WithMany(p => p.TbHostScenes) + .HasForeignKey(d => d.RoomTypeSceneId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_tb_HostScene_tb_RoomTypeScene"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_HostTimingControl"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.ExecStatus) + .HasDefaultValue(false) + .HasComment("执行状态:0未执行,1已执行"); + entity.Property(e => e.ExecTime) + .HasComment("执行时间") + .HasColumnType("datetime"); + entity.Property(e => e.GroupId) + .HasDefaultValue(0) + .HasComment("楼层ID") + .HasColumnName("GroupID"); + entity.Property(e => e.HostIds) + .HasMaxLength(1000) + .IsUnicode(false) + .HasDefaultValue("") + .HasComment("主机ID,以逗号隔开") + .HasColumnName("HostIDs"); + entity.Property(e => e.HotelId) + .HasComment("酒店ID") + .HasColumnName("HotelID"); + entity.Property(e => e.RoomCardTypeId) + .HasDefaultValue(0) + .HasComment("房卡类型ID") + .HasColumnName("RoomCardTypeID"); + entity.Property(e => e.RoomStatusId) + .HasDefaultValue(0) + .HasComment("房态ID") + .HasColumnName("RoomStatusID"); + entity.Property(e => e.RoomTypeId) + .HasDefaultValue(0) + .HasComment("房型ID") + .HasColumnName("RoomTypeID"); + entity.Property(e => e.RoomTypeSceneId) + .HasComment("场景ID") + .HasColumnName("RoomTypeSceneID"); + entity.Property(e => e.Timing) + .HasMaxLength(600) + .IsUnicode(false) + .HasComment("定时时间(时:分)"); + entity.Property(e => e.TimingDay) + .HasMaxLength(255) + .IsUnicode(false) + .HasComment("具体星期几或几号"); + entity.Property(e => e.TimingType).HasComment("定时类型:0每天,1每周,2每月"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_HostUpdate"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Account) + .HasMaxLength(20) + .HasComment("上传人"); + entity.Property(e => e.FileName) + .HasMaxLength(100) + .HasComment("升级包名称"); + entity.Property(e => e.FileType).HasComment("文件类型:0/主机固件文件,1/配置数据文件"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Href) + .HasMaxLength(250) + .HasComment("路径"); + entity.Property(e => e.Md5) + .HasMaxLength(32) + .IsUnicode(false) + .IsFixedLength() + .HasComment("Md5值"); + entity.Property(e => e.Size).HasComment("文件大小"); + entity.Property(e => e.UploadTime) + .HasComment("上传日期") + .HasColumnType("datetime"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_HostUpdateStatus"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.HostId) + .HasComment("主机ID") + .HasColumnName("HostID"); + entity.Property(e => e.HostUpdateId) + .HasComment("升级包ID") + .HasColumnName("HostUpdateID"); + entity.Property(e => e.PublishTime) + .HasComment("发布时间") + .HasColumnType("datetime"); + entity.Property(e => e.Status) + .HasDefaultValue(0) + .HasComment("状态"); + entity.Property(e => e.UpdatedTime) + .HasComment("升级时间") + .HasColumnType("datetime"); + + entity.HasOne(d => d.Host).WithMany(p => p.TbHostUpdateStatuses) + .HasForeignKey(d => d.HostId) + .HasConstraintName("FK_tb_HostUpdateStatus_tb_Hosts"); + + entity.HasOne(d => d.HostUpdate).WithMany(p => p.TbHostUpdateStatuses) + .HasForeignKey(d => d.HostUpdateId) + .HasConstraintName("FK_tb_HostUpdateStatus_tb_HostUpdate"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_HostWordsReport"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CreatedDate).HasColumnType("datetime"); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.ModalAddress) + .HasMaxLength(20) + .IsUnicode(false); + entity.Property(e => e.Sentence).HasMaxLength(500); + entity.Property(e => e.Type).HasDefaultValue((short)1); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__tb_Hosts__3214EC276B572E08"); + + entity.ToTable("tb_HostsRCU"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.ConfigVersion).HasMaxLength(255); + entity.Property(e => e.Core).HasMaxLength(64); + entity.Property(e => e.Dns) + .HasMaxLength(255) + .HasColumnName("DNS"); + entity.Property(e => e.ExpireTime).HasColumnType("datetime"); + entity.Property(e => e.Gateway).HasMaxLength(255); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.HotelCode).HasMaxLength(255); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.HotelName).HasMaxLength(32); + entity.Property(e => e.Iptype).HasColumnName("IPType"); + entity.Property(e => e.LanIp) + .HasMaxLength(255) + .HasColumnName("LanIP"); + entity.Property(e => e.LauncherVersion).HasMaxLength(255); + entity.Property(e => e.Mac) + .HasMaxLength(255) + .HasColumnName("MAC"); + entity.Property(e => e.Model).HasMaxLength(64); + entity.Property(e => e.RoomNumber).HasMaxLength(16); + entity.Property(e => e.RoomRemark).HasMaxLength(96); + entity.Property(e => e.RoomStatus).HasMaxLength(255); + entity.Property(e => e.RoomStatusId).HasColumnName("RoomStatusID"); + entity.Property(e => e.RoomType).HasMaxLength(16); + entity.Property(e => e.RoomTypeId).HasColumnName("RoomTypeID"); + entity.Property(e => e.RoomTypeRemark).HasMaxLength(32); + entity.Property(e => e.RunTime).HasColumnType("datetime"); + entity.Property(e => e.Season).HasMaxLength(255); + entity.Property(e => e.ServerIp) + .HasMaxLength(255) + .HasColumnName("ServerIP"); + entity.Property(e => e.SetExpireTime).HasColumnType("datetime"); + entity.Property(e => e.SubnetMask).HasMaxLength(255); + entity.Property(e => e.TypeNumber).HasMaxLength(255); + entity.Property(e => e.UpdateTime).HasColumnType("datetime"); + entity.Property(e => e.Version).HasMaxLength(255); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__tb_Hotel__3214EC278E40FBA6"); + + entity.ToTable("tb_HotelAirControl"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.ModifiedDate).HasColumnType("datetime"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_HotelSeason"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + + entity.HasOne(d => d.Hotel).WithMany(p => p.TbHotelSeasons) + .HasForeignKey(d => d.HotelId) + .HasConstraintName("FK_tb_HotelSeason_tb_Sys_Hotels"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__tb_Manua__3214EC276F212F46"); + + entity.ToTable("tb_ManualVisit"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CompanyName).HasMaxLength(30); + entity.Property(e => e.CreatedDate).HasColumnType("datetime"); + entity.Property(e => e.Name).HasMaxLength(20); + entity.Property(e => e.PhoneNumber).HasMaxLength(20); + entity.Property(e => e.ValidateCode).HasMaxLength(4); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_ModalType"); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasColumnName("ID"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Name).HasMaxLength(20); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_Models"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.ApplyDate) + .HasComment("应用时间") + .HasColumnType("datetime"); + entity.Property(e => e.ApplyUser) + .HasMaxLength(20) + .HasComment("操作人"); + entity.Property(e => e.CorrectedTemp).HasComment("温度修正值"); + entity.Property(e => e.DoorDelayPo) + .HasDefaultValue(1) + .HasComment("门磁延时断电时间(秒)") + .HasColumnName("DoorDelayPO"); + entity.Property(e => e.ExhausFanTime) + .HasDefaultValue(5) + .HasComment("定时时长(分钟/每小时)"); + entity.Property(e => e.ExhaustFanStatus) + .HasDefaultValue(1) + .HasComment("屋内无人时排气扇状态:0关1开2定时"); + entity.Property(e => e.FanRunStatus).HasComment("到达温度后风机是否保持低速运行"); + entity.Property(e => e.Hosts) + .IsUnicode(false) + .HasComment("所应用的主机ID,以逗号隔开"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.InfraredDelayPo) + .HasDefaultValue(1) + .HasComment("红外延时断电时间(分)") + .HasColumnName("InfraredDelayPO"); + entity.Property(e => e.ModifiedDate) + .HasComment("编辑时间") + .HasColumnType("datetime"); + entity.Property(e => e.Name) + .HasMaxLength(20) + .HasComment("配置方案名称"); + entity.Property(e => e.PullCardDelayPo) + .HasDefaultValue(1) + .HasComment("拔卡延时断电时间(秒)") + .HasColumnName("PullCardDelayPO"); + entity.Property(e => e.Remark) + .HasMaxLength(100) + .HasComment("备注"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_ModelDetail"); + + entity.Property(e => e.Id) + .HasComment("ID") + .HasColumnName("ID"); + entity.Property(e => e.AllowElectric) + .HasDefaultValue(false) + .HasComment("允许用电"); + entity.Property(e => e.ModelId) + .HasComment("主表ID") + .HasColumnName("ModelID"); + entity.Property(e => e.ModelStatus) + .HasMaxLength(50) + .HasComment("状态"); + entity.Property(e => e.ModelType) + .HasDefaultValue(false) + .HasComment("类型:手动0,自动1"); + entity.Property(e => e.OnOff) + .HasDefaultValue(false) + .HasComment("开关"); + entity.Property(e => e.Speed) + .HasDefaultValue(0) + .HasComment("速度:停止0,低速1,中速2,高速3"); + entity.Property(e => e.SummerTemp) + .HasDefaultValue(0) + .HasComment("夏季温度"); + entity.Property(e => e.Timer) + .HasDefaultValue(0) + .HasComment("定时时长(分钟/每小时)"); + entity.Property(e => e.TimingControl) + .HasDefaultValue(false) + .HasComment("定时控制"); + entity.Property(e => e.WinterTemp) + .HasDefaultValue(0) + .HasComment("冬季温度"); + + entity.HasOne(d => d.Model).WithMany(p => p.TbModelDetails) + .HasForeignKey(d => d.ModelId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_tb_ModelDetail_tb_Models"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_RoomCard"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CardNumber) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("房卡编号"); + entity.Property(e => e.CardTypeId) + .HasComment("房卡类型ID") + .HasColumnName("CardTypeID"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Sort) + .HasDefaultValue(1) + .HasComment("排序"); + entity.Property(e => e.UserName) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("员工姓名"); + entity.Property(e => e.UserNumber) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("员工编号"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_RoomCardType"); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasColumnName("ID"); + entity.Property(e => e.EtypeName) + .HasMaxLength(50) + .HasColumnName("ETypeName"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.TwtypeName) + .HasMaxLength(50) + .HasColumnName("TWTypeName"); + entity.Property(e => e.TypeName).HasMaxLength(50); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.ModalAddress).HasName("PK_tb_RoomTypeLoop"); + + entity.ToTable("tb_RoomModal"); + + entity.Property(e => e.ModalAddress) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("回路地址"); + entity.Property(e => e.Color) + .HasMaxLength(10) + .IsUnicode(false); + entity.Property(e => e.ModalId) + .HasMaxLength(255) + .HasColumnName("ModalID"); + entity.Property(e => e.ModalName).HasMaxLength(255); + entity.Property(e => e.Name) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("名称"); + entity.Property(e => e.Outlet) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("输出口"); + entity.Property(e => e.Power) + .HasDefaultValue(0) + .HasComment("功率(单位:瓦)"); + entity.Property(e => e.Remark).HasMaxLength(255); + entity.Property(e => e.Sort).HasDefaultValue(1); + entity.Property(e => e.Type).HasComment("类型"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_RoomModalType"); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasColumnName("ID"); + entity.Property(e => e.Cname) + .HasMaxLength(50) + .HasColumnName("CName"); + entity.Property(e => e.Ename) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("EName"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_RoomService"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.AlarmCode) + .HasMaxLength(3) + .IsUnicode(false) + .IsFixedLength() + .HasComment("服务类型"); + entity.Property(e => e.AlarmType) + .HasMaxLength(1) + .IsFixedLength(); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.StartTime) + .HasComment("操作时间") + .HasColumnType("datetime"); + entity.Property(e => e.Status) + .HasDefaultValue(true) + .HasComment("状态"); + + entity.HasOne(d => d.Host).WithMany(p => p.TbRoomServices) + .HasForeignKey(d => d.HostId) + .HasConstraintName("FK_tb_RoomService_tb_Hosts"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_RoomServiceRecords"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Account) + .HasMaxLength(20) + .HasComment("操作人"); + entity.Property(e => e.AlarmCode) + .HasMaxLength(3) + .IsUnicode(false) + .IsFixedLength() + .HasComment("服务类型"); + entity.Property(e => e.EndTime).HasColumnType("datetime"); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.Name).HasMaxLength(50); + entity.Property(e => e.RoomNumber) + .HasMaxLength(20) + .HasComment("房号"); + entity.Property(e => e.StartTime) + .HasComment("操作时间") + .HasColumnType("datetime"); + entity.Property(e => e.Status) + .HasDefaultValue(true) + .HasComment("状态"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_tb_RoomDict_1"); + + entity.ToTable("tb_RoomStatus"); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasComment("类型") + .HasColumnName("ID"); + entity.Property(e => e.Color) + .HasMaxLength(10) + .IsUnicode(false); + entity.Property(e => e.Ename) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("名称") + .HasColumnName("EName"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Name) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("名称"); + entity.Property(e => e.Sort) + .HasDefaultValue(1) + .HasComment("排序"); + entity.Property(e => e.Twname) + .HasMaxLength(50) + .HasColumnName("TWName"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_RoomStatusAid"); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasComment("类型") + .HasColumnName("ID"); + entity.Property(e => e.ActiveIndicator) + .HasDefaultValue(true) + .HasComment("启用"); + entity.Property(e => e.Ename) + .HasMaxLength(50) + .HasColumnName("EName"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Name) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("辅助房态名称"); + entity.Property(e => e.Sort) + .HasDefaultValue(1) + .HasComment("排序"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_RoomType"); + + entity.Property(e => e.Id) + .HasComment("ID") + .HasColumnName("ID"); + entity.Property(e => e.Code) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("房型编号"); + entity.Property(e => e.ConfigFileName).HasMaxLength(255); + entity.Property(e => e.ConfigFilePath).HasMaxLength(255); + entity.Property(e => e.Content).HasColumnType("ntext"); + entity.Property(e => e.ControlType) + .HasDefaultValue(0) + .HasComment("空调管制:0/二管制,1/四管制"); + entity.Property(e => e.Day) + .HasMaxLength(15) + .HasComment("白天时间"); + entity.Property(e => e.GroupAddress) + .HasMaxLength(10) + .HasComment("组地址"); + entity.Property(e => e.HostName) + .HasMaxLength(50) + .HasComment("主机上定义的房型名称"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.LastModifiedTime) + .HasColumnType("datetime") + .HasColumnName("Last_Modified_Time"); + entity.Property(e => e.Name) + .HasMaxLength(50) + .HasComment("房型名称"); + entity.Property(e => e.Night).HasMaxLength(15); + entity.Property(e => e.ProjectId) + .HasComment("项目号") + .HasColumnName("ProjectID"); + entity.Property(e => e.RoomArea).HasMaxLength(255); + entity.Property(e => e.RoomHeight).HasMaxLength(255); + entity.Property(e => e.RoomHotLossRatio).HasMaxLength(255); + entity.Property(e => e.SavingModeTime).HasMaxLength(15); + entity.Property(e => e.UploadTime) + .HasComment("上传日期") + .HasColumnType("datetime"); + entity.Property(e => e.Uploader) + .HasMaxLength(20) + .HasComment("上传人"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_RoomTypeAir"); + + entity.Property(e => e.Id) + .HasComment("ID") + .HasColumnName("ID"); + entity.Property(e => e.CustomerName) + .HasMaxLength(50) + .HasComment("自定义名称"); + entity.Property(e => e.EnglishName) + .HasMaxLength(50) + .HasComment("英文名称"); + entity.Property(e => e.ModalTypeId) + .HasComment("类型") + .HasColumnName("ModalTypeID"); + entity.Property(e => e.ModalTypeName) + .HasMaxLength(50) + .HasComment("配置名称"); + entity.Property(e => e.RoomTypeId) + .HasComment("房型") + .HasColumnName("RoomTypeID"); + entity.Property(e => e.Sort).HasDefaultValue(1); + + entity.HasOne(d => d.ModalType).WithMany(p => p.TbRoomTypeAirs) + .HasForeignKey(d => d.ModalTypeId) + .HasConstraintName("FK_tb_RoomTypeAir_tb_ModalType"); + + entity.HasOne(d => d.RoomType).WithMany(p => p.TbRoomTypeAirs) + .HasForeignKey(d => d.RoomTypeId) + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("FK_tb_RoomTypeAir_tb_RoomType"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__tb_RoomT__3214EC27B1BCD35A"); + + entity.ToTable("tb_RoomTypeChannels"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Name).HasMaxLength(10); + entity.Property(e => e.RoomTypeId).HasColumnName("RoomTypeID"); + + entity.HasOne(d => d.RoomType).WithMany(p => p.TbRoomTypeChannels) + .HasForeignKey(d => d.RoomTypeId) + .HasConstraintName("FK_tb_RoomTypeChannels_tb_RoomType"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_RoomTypeModal"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.AliasName).HasMaxLength(255); + entity.Property(e => e.AppApply) + .HasDefaultValue(false) + .HasComment("是否移动端上应用"); + entity.Property(e => e.Color) + .HasMaxLength(10) + .IsUnicode(false); + entity.Property(e => e.Default1).HasDefaultValue(true); + entity.Property(e => e.EnglishName) + .HasMaxLength(50) + .HasComment("英文名称"); + entity.Property(e => e.ModalAddress) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("回路地址"); + entity.Property(e => e.MultipleGroupId).HasColumnName("MultipleGroupID"); + entity.Property(e => e.MultipleTclname) + .HasMaxLength(255) + .HasColumnName("MultipleTCLName"); + entity.Property(e => e.Name) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("名称"); + entity.Property(e => e.Outlet) + .HasMaxLength(50) + .HasComment("输出口"); + entity.Property(e => e.Power) + .HasDefaultValue(0) + .HasComment("功率(单位:瓦)"); + entity.Property(e => e.RoomTypeId) + .HasComment("外键ID") + .HasColumnName("RoomTypeID"); + entity.Property(e => e.Sort).HasDefaultValue(1); + entity.Property(e => e.Subtype).HasComment("二级类型"); + entity.Property(e => e.TcldeviceName) + .HasMaxLength(255) + .HasColumnName("TCLDeviceName"); + entity.Property(e => e.Twname) + .HasMaxLength(50) + .HasColumnName("TWName"); + entity.Property(e => e.Type).HasComment("类型"); + entity.Property(e => e.WxactiveIndicator).HasColumnName("WXActiveIndicator"); + + entity.HasOne(d => d.RoomType).WithMany(p => p.TbRoomTypeModals) + .HasForeignKey(d => d.RoomTypeId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_tb_RoomTypeModal_tb_RoomType"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__tb_RoomT__3214EC27A2BA23BA"); + + entity.ToTable("tb_RoomTypeProgramFiles"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Account).HasMaxLength(255); + entity.Property(e => e.FileName).HasMaxLength(255); + entity.Property(e => e.Href).HasMaxLength(255); + entity.Property(e => e.Md5).HasMaxLength(255); + entity.Property(e => e.RoomTypeId).HasColumnName("RoomTypeID"); + entity.Property(e => e.UploadTime).HasColumnType("datetime"); + + entity.HasOne(d => d.RoomType).WithMany(p => p.TbRoomTypeProgramFiles) + .HasForeignKey(d => d.RoomTypeId) + .HasConstraintName("FK_tb_RoomTypeProgramFiles_tb_RoomType"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_RoomTypeScene"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.AliasName).HasMaxLength(255); + entity.Property(e => e.AppApply) + .HasDefaultValue(false) + .HasComment("是否移动端上应用"); + entity.Property(e => e.EnglishName) + .HasMaxLength(50) + .IsUnicode(false) + .HasComment("场景英文名称"); + entity.Property(e => e.GroupAddress) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("组地址"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Icon).HasMaxLength(500); + entity.Property(e => e.Name) + .HasMaxLength(50) + .HasComment("场景中文名称"); + entity.Property(e => e.RoomTypeId) + .HasComment("房型ID") + .HasColumnName("RoomTypeID"); + entity.Property(e => e.Sort).HasDefaultValue(1); + entity.Property(e => e.Twname) + .HasMaxLength(255) + .HasColumnName("TWName"); + entity.Property(e => e.Type).HasComment("0.自定义场景 1.指令场景"); + + entity.HasOne(d => d.RoomType).WithMany(p => p.TbRoomTypeScenes) + .HasForeignKey(d => d.RoomTypeId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_tb_RoomTypeScene_tb_RoomType"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_tb_RoomTypeSceneModal_1"); + + entity.ToTable("tb_RoomTypeSceneModal"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Brightness) + .HasDefaultValue(0) + .HasComment("亮度"); + entity.Property(e => e.ModalId) + .HasMaxLength(255) + .HasColumnName("ModalID"); + entity.Property(e => e.RoomTypeModalId) + .HasComment("模块ID") + .HasColumnName("RoomTypeModalID"); + entity.Property(e => e.RoomTypeSceneId).HasColumnName("RoomTypeSceneID"); + entity.Property(e => e.Status).HasComment("设备状态:0关,1开"); + + entity.HasOne(d => d.RoomTypeModal).WithMany(p => p.TbRoomTypeSceneModals) + .HasForeignKey(d => d.RoomTypeModalId) + .HasConstraintName("FK_tb_RoomTypeSceneModal_tb_RoomTypeModal"); + + entity.HasOne(d => d.RoomTypeScene).WithMany(p => p.TbRoomTypeSceneModals) + .HasForeignKey(d => d.RoomTypeSceneId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_tb_RoomTypeSceneModal_tb_RoomTypeScene"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_RoomTypeWXMenus"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Class) + .HasMaxLength(30) + .IsUnicode(false); + entity.Property(e => e.Code) + .HasMaxLength(10) + .IsUnicode(false); + entity.Property(e => e.Ename) + .HasMaxLength(50) + .HasColumnName("EName"); + entity.Property(e => e.Name).HasMaxLength(20); + entity.Property(e => e.RoomTypeId).HasColumnName("RoomTypeID"); + entity.Property(e => e.Twname) + .HasMaxLength(50) + .HasColumnName("TWName"); + + entity.HasOne(d => d.RoomType).WithMany(p => p.TbRoomTypeWxmenus) + .HasForeignKey(d => d.RoomTypeId) + .HasConstraintName("FK_tb_RoomTypeWXMenus_tb_RoomType"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_Season"); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasComment("ID") + .HasColumnName("ID"); + entity.Property(e => e.BeginDate) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("开始日期"); + entity.Property(e => e.EndDate) + .HasMaxLength(20) + .IsUnicode(false) + .HasComment("结束日期"); + entity.Property(e => e.Name) + .HasMaxLength(10) + .HasComment("季节名称"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_Sys_ActiveUser"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Account).HasMaxLength(20); + entity.Property(e => e.LoginIp) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("LoginIP"); + entity.Property(e => e.SessionId) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("SessionID"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_tb_SecurityAuthorities"); + + entity.ToTable("tb_Sys_Authorities"); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasColumnName("ID"); + entity.Property(e => e.ActiveIndicator) + .HasDefaultValue(true) + .HasComment("启用"); + entity.Property(e => e.Ename) + .HasMaxLength(50) + .HasComment("英文名称") + .HasColumnName("EName"); + entity.Property(e => e.Icon).HasMaxLength(500); + entity.Property(e => e.IsMenu).HasDefaultValue(true); + entity.Property(e => e.Name) + .HasMaxLength(50) + .HasComment("名称"); + entity.Property(e => e.ParentId) + .HasComment("父节点ID") + .HasColumnName("ParentID"); + entity.Property(e => e.Sort) + .HasDefaultValue(1) + .HasComment("排序"); + entity.Property(e => e.Twname) + .HasMaxLength(50) + .HasColumnName("TWName"); + entity.Property(e => e.Url) + .HasMaxLength(500) + .HasComment("权限组"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_Sys_City"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Code) + .HasMaxLength(12) + .IsUnicode(false); + entity.Property(e => e.Ename) + .HasMaxLength(30) + .IsUnicode(false) + .HasColumnName("EName"); + entity.Property(e => e.Name).HasMaxLength(10); + entity.Property(e => e.ProvinceCode) + .HasMaxLength(12) + .IsUnicode(false); + entity.Property(e => e.Twname) + .HasMaxLength(10) + .HasColumnName("TWName"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_Sys_County"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CityCode) + .HasMaxLength(12) + .IsUnicode(false); + entity.Property(e => e.Code) + .HasMaxLength(12) + .IsUnicode(false); + entity.Property(e => e.Ename) + .HasMaxLength(30) + .IsUnicode(false) + .HasColumnName("EName"); + entity.Property(e => e.Name).HasMaxLength(10); + entity.Property(e => e.Twname) + .HasMaxLength(10) + .HasColumnName("TWName"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_tb_Districts"); + + entity.ToTable("tb_Sys_Districts"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.ActiveIndicator) + .HasDefaultValue(true) + .HasComment("启用"); + entity.Property(e => e.Code) + .HasMaxLength(20) + .HasDefaultValue("") + .HasComment("代码"); + entity.Property(e => e.CreatedBy) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("创建人"); + entity.Property(e => e.CreatedDate) + .HasDefaultValueSql("(getdate())") + .HasComment("创建时间") + .HasColumnType("datetime"); + entity.Property(e => e.ModifiedBy) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("修改人"); + entity.Property(e => e.ModifiedDate) + .HasDefaultValueSql("(getdate())") + .HasComment("修改时间") + .HasColumnType("datetime"); + entity.Property(e => e.Name) + .HasMaxLength(20) + .HasDefaultValue("") + .HasComment("名称"); + entity.Property(e => e.ParentId) + .HasDefaultValue(0) + .HasComment("上级部门") + .HasColumnName("ParentID"); + entity.Property(e => e.Remark) + .HasMaxLength(200) + .HasDefaultValue("") + .HasComment("备注"); + entity.Property(e => e.Sort).HasComment("排序"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_tb_Departments"); + + entity.ToTable("tb_Sys_Hotels"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.ActiveIndicator) + .HasDefaultValue(true) + .HasComment("启用"); + entity.Property(e => e.Address) + .HasMaxLength(300) + .HasComment("地址"); + entity.Property(e => e.AssociatedAccount).HasMaxLength(20); + entity.Property(e => e.CityCode).HasMaxLength(12); + entity.Property(e => e.Code) + .HasMaxLength(20) + .IsUnicode(false) + .HasDefaultValue("") + .HasComment("酒店代码"); + entity.Property(e => e.Contact) + .HasMaxLength(20) + .HasComment("联系人"); + entity.Property(e => e.CountyCode).HasMaxLength(12); + entity.Property(e => e.CreatedBy) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("创建人"); + entity.Property(e => e.CreatedDate) + .HasDefaultValueSql("(getdate())") + .HasComment("创建时间") + .HasColumnType("datetime"); + entity.Property(e => e.DeviceStatusPushUrl) + .HasMaxLength(255) + .IsUnicode(false) + .HasColumnName("DeviceStatusPushURL"); + entity.Property(e => e.DomainUrl) + .HasMaxLength(255) + .IsUnicode(false); + entity.Property(e => e.Ename) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("英文名称") + .HasColumnName("EName"); + entity.Property(e => e.EndDayTime).HasDefaultValue(18); + entity.Property(e => e.FaultPushUrl) + .HasMaxLength(255) + .IsUnicode(false) + .HasColumnName("FaultPushURL"); + entity.Property(e => e.FcsCarbonUuid) + .HasMaxLength(255) + .HasColumnName("FCS_Carbon_UUID"); + entity.Property(e => e.FcsCleanUuid) + .HasMaxLength(255) + .HasColumnName("FCS_Clean_UUID"); + entity.Property(e => e.FcsMenCiClose) + .HasMaxLength(255) + .HasColumnName("FCS_MenCi_Close"); + entity.Property(e => e.FcsMenCiOpen) + .HasMaxLength(255) + .HasColumnName("FCS_MenCi_Open"); + entity.Property(e => e.FcsPropertyId) + .HasMaxLength(255) + .HasColumnName("FCS_PropertyID"); + entity.Property(e => e.FcsRcuDeviceOffline) + .HasMaxLength(255) + .HasColumnName("FCS_RCU_Device_Offline"); + entity.Property(e => e.FcsRcuOffline) + .HasMaxLength(255) + .HasColumnName("FCS_RCU_Offline"); + entity.Property(e => e.FcsRcuOnline) + .HasMaxLength(255) + .HasColumnName("FCS_RCU_Online"); + entity.Property(e => e.FcsSosUuid) + .HasMaxLength(255) + .HasColumnName("FCS_SOS_UUID"); + entity.Property(e => e.FcsTiSongWuPin) + .HasMaxLength(255) + .HasColumnName("FCS_TiSongWuPin"); + entity.Property(e => e.FcsTouSuUuid) + .HasMaxLength(255) + .HasColumnName("FCS_TouSu_UUID"); + entity.Property(e => e.FcsloginPassWord) + .HasMaxLength(255) + .HasColumnName("FCSLoginPassWord"); + entity.Property(e => e.FcsloginUrl) + .HasMaxLength(255) + .HasColumnName("FCSLoginUrl"); + entity.Property(e => e.FcsloginUserName) + .HasMaxLength(255) + .HasColumnName("FCSLoginUserName"); + entity.Property(e => e.FcspushEnable).HasColumnName("FCSPushEnable"); + entity.Property(e => e.GoodbyeSpeech).HasMaxLength(255); + entity.Property(e => e.HeTongNumber).HasMaxLength(255); + entity.Property(e => e.IsPushPmsdata).HasColumnName("IsPushPMSData"); + entity.Property(e => e.IsSyncPms).HasColumnName("IsSyncPMS"); + entity.Property(e => e.IsUseQianLiMa).HasDefaultValue(false); + entity.Property(e => e.IsUseSkyworthTv) + .HasDefaultValue(false) + .HasColumnName("IsUseSkyworthTV"); + entity.Property(e => e.IsUseTcltv).HasColumnName("IsUseTCLTV"); + entity.Property(e => e.LastModifiedTime) + .HasColumnType("datetime") + .HasColumnName("Last_Modified_Time"); + entity.Property(e => e.LogoPath).HasMaxLength(255); + entity.Property(e => e.ModifiedBy) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("修改人"); + entity.Property(e => e.ModifiedDate) + .HasDefaultValueSql("(getdate())") + .HasComment("修改时间") + .HasColumnType("datetime"); + entity.Property(e => e.Name) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("名称"); + entity.Property(e => e.ParentId) + .HasDefaultValue(0) + .HasComment("上级部门") + .HasColumnName("ParentID"); + entity.Property(e => e.Phone) + .HasMaxLength(50) + .HasComment("联系电话"); + entity.Property(e => e.ProvinceCode).HasMaxLength(12); + entity.Property(e => e.Remark) + .HasMaxLength(200) + .HasDefaultValue("") + .HasComment("备注"); + entity.Property(e => e.SkyworthTvauthCode) + .HasMaxLength(64) + .HasColumnName("SkyworthTVauthCode"); + entity.Property(e => e.Sort).HasComment("排序"); + entity.Property(e => e.StartDayTime).HasDefaultValue(6); + entity.Property(e => e.Styles).HasMaxLength(10); + entity.Property(e => e.SysHotelGroupId).HasColumnName("SysHotelGroupID"); + entity.Property(e => e.TouSuResponseData).HasMaxLength(255); + entity.Property(e => e.TvcontrolToken) + .HasMaxLength(255) + .IsUnicode(false) + .HasColumnName("TVControlToken"); + entity.Property(e => e.TvcontrolUrl) + .HasMaxLength(255) + .IsUnicode(false) + .HasColumnName("TVControlUrl"); + entity.Property(e => e.Twname) + .HasMaxLength(50) + .HasColumnName("TWName"); + entity.Property(e => e.ValidateDate).HasColumnType("datetime"); + entity.Property(e => e.WelcomeSpeech).HasMaxLength(100); + entity.Property(e => e.Wxvalidate) + .HasMaxLength(50) + .HasComment("登录密码") + .HasColumnName("WXValidate"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__tb_Sys_H__3214EC27FF6B76C7"); + + entity.ToTable("tb_Sys_HotelGroups"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.LastModifiedTime) + .HasColumnType("datetime") + .HasColumnName("Last_Modified_Time"); + entity.Property(e => e.Name).HasMaxLength(255); + entity.Property(e => e.ParentId).HasColumnName("ParentID"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__tb_Sys_O__3214EC27A89399CA"); + + entity.ToTable("tb_Sys_Oauth2"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.AccessToken).HasMaxLength(600); + entity.Property(e => e.Account).HasMaxLength(20); + entity.Property(e => e.Code).HasMaxLength(100); + entity.Property(e => e.CreatedDate).HasColumnType("datetime"); + entity.Property(e => e.RedirectUri).HasMaxLength(100); + entity.Property(e => e.RefreshToken).HasMaxLength(600); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_Sys_Positions"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.ActiveIndicator) + .HasDefaultValue(true) + .HasComment("启用"); + entity.Property(e => e.Code).HasMaxLength(10); + entity.Property(e => e.CreatedBy) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("创建人"); + entity.Property(e => e.CreatedDate) + .HasDefaultValueSql("(getdate())") + .HasComment("创建时间") + .HasColumnType("datetime"); + entity.Property(e => e.ModifiedBy) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("修改人"); + entity.Property(e => e.ModifiedDate) + .HasDefaultValueSql("(getdate())") + .HasComment("修改时间") + .HasColumnType("datetime"); + entity.Property(e => e.Name) + .HasMaxLength(20) + .HasComment("名称"); + entity.Property(e => e.Remark) + .HasMaxLength(200) + .HasComment("备注"); + entity.Property(e => e.Sort).HasComment("排序"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_Sys_Province"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Code) + .HasMaxLength(12) + .IsUnicode(false); + entity.Property(e => e.Ename) + .HasMaxLength(30) + .IsUnicode(false) + .HasColumnName("EName"); + entity.Property(e => e.Name).HasMaxLength(10); + entity.Property(e => e.Twname) + .HasMaxLength(10) + .HasColumnName("TWName"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_tb_SecurityRoles"); + + entity.ToTable("tb_Sys_Roles"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.ActiveIndicator) + .HasDefaultValue(true) + .HasComment("启用"); + entity.Property(e => e.CreatedBy) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("创建人"); + entity.Property(e => e.CreatedDate) + .HasDefaultValueSql("(getdate())") + .HasComment("创建时间") + .HasColumnType("datetime"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.ModifiedBy) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("修改人"); + entity.Property(e => e.ModifiedDate) + .HasDefaultValueSql("(getdate())") + .HasComment("修改时间") + .HasColumnType("datetime"); + entity.Property(e => e.Name) + .HasMaxLength(20) + .HasComment("名称"); + entity.Property(e => e.Remark) + .HasMaxLength(200) + .HasComment("备注"); + entity.Property(e => e.Sort).HasComment("排序"); + entity.Property(e => e.SysHotelGroupId).HasColumnName("SysHotelGroupID"); + + entity.HasMany(d => d.Authorities).WithMany(p => p.Roles) + .UsingEntity>( + "TbSysRoleAuthority", + r => r.HasOne().WithMany() + .HasForeignKey("AuthorityId") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_tb_SecurityRoleAuthorities_tb_SecurityAuthorities"), + l => l.HasOne().WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_tb_SecurityRoleAuthorities_tb_SecurityRoles"), + j => + { + j.HasKey("RoleId", "AuthorityId").HasName("PK_tb_SecurityRoleAuthorities"); + j.ToTable("tb_Sys_RoleAuthorities"); + j.IndexerProperty("RoleId") + .HasComment("角色ID") + .HasColumnName("RoleID"); + j.IndexerProperty("AuthorityId") + .HasComment("权限ID") + .HasColumnName("AuthorityID"); + }); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_tb_Seek"); + + entity.ToTable("tb_Sys_Seek"); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasColumnName("ID"); + entity.Property(e => e.Prefix).HasMaxLength(20); + entity.Property(e => e.Remark).HasMaxLength(200); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_Sys_Setting"); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasColumnName("ID"); + entity.Property(e => e.AllowEdit).HasComment("是否允许界面编辑"); + entity.Property(e => e.Eremark) + .HasMaxLength(50) + .HasColumnName("ERemark"); + entity.Property(e => e.Etype) + .HasMaxLength(50) + .HasComment("分类") + .HasColumnName("EType"); + entity.Property(e => e.Name) + .HasMaxLength(50) + .IsUnicode(false) + .HasComment("名称"); + entity.Property(e => e.Remark).HasMaxLength(50); + entity.Property(e => e.Type) + .HasMaxLength(50) + .HasComment("分类"); + entity.Property(e => e.Value) + .HasMaxLength(50) + .HasComment("值"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_tb_SystemLogs"); + + entity.ToTable("tb_Sys_SystemLogs"); + + entity.Property(e => e.Id) + .HasComment("id") + .HasColumnName("ID"); + entity.Property(e => e.Account) + .HasMaxLength(20) + .HasComment("用户名"); + entity.Property(e => e.Action) + .HasMaxLength(50) + .HasComment("动作"); + entity.Property(e => e.AuthorityId) + .HasComment("权限模块ID") + .HasColumnName("AuthorityID"); + entity.Property(e => e.Detail) + .HasMaxLength(2000) + .HasComment("明细"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Ip) + .HasMaxLength(50) + .IsUnicode(false) + .HasComment("IP地址") + .HasColumnName("IP"); + entity.Property(e => e.Result) + .HasMaxLength(100) + .HasComment("结果"); + entity.Property(e => e.Time) + .HasComment("操作日期") + .HasColumnType("datetime"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK_tb_Users"); + + entity.ToTable("tb_Sys_Users"); + + entity.Property(e => e.Id) + .HasComment("ID") + .HasColumnName("ID"); + entity.Property(e => e.Account) + .HasMaxLength(20) + .HasComment("登录账号"); + entity.Property(e => e.ActiveIndicator) + .HasDefaultValue(true) + .HasComment("启用"); + entity.Property(e => e.CreatedBy) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("创建人"); + entity.Property(e => e.CreatedDate) + .HasDefaultValueSql("(getdate())") + .HasComment("创建时间") + .HasColumnType("datetime"); + entity.Property(e => e.DepartmentId) + .HasComment("所属部门") + .HasColumnName("DepartmentID"); + entity.Property(e => e.DistrictId).HasColumnName("DistrictID"); + entity.Property(e => e.Email) + .HasMaxLength(50) + .HasComment("邮件"); + entity.Property(e => e.GroupId) + .HasComment("所属分组ID") + .HasColumnName("GroupID"); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.LastModifiedTime) + .HasColumnType("datetime") + .HasColumnName("Last_Modified_Time"); + entity.Property(e => e.LoginIp) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("LoginIP"); + entity.Property(e => e.ModifiedBy) + .HasMaxLength(50) + .HasDefaultValue("") + .HasComment("修改人"); + entity.Property(e => e.ModifiedDate) + .HasDefaultValueSql("(getdate())") + .HasComment("修改时间") + .HasColumnType("datetime"); + entity.Property(e => e.Name) + .HasMaxLength(20) + .HasDefaultValue("") + .HasComment("姓名"); + entity.Property(e => e.Password) + .HasMaxLength(50) + .HasComment("登录密码"); + entity.Property(e => e.Password2).HasMaxLength(255); + entity.Property(e => e.Phone).HasMaxLength(50); + entity.Property(e => e.PositionId).HasColumnName("PositionID"); + entity.Property(e => e.Remark) + .HasMaxLength(200) + .HasComment("备注"); + entity.Property(e => e.RoleId).HasColumnName("RoleID"); + entity.Property(e => e.Sex) + .HasMaxLength(2) + .IsFixedLength(); + entity.Property(e => e.Sort) + .HasDefaultValue(1) + .HasComment("排序"); + entity.Property(e => e.SysHotelGroupId).HasColumnName("SysHotelGroupID"); + + entity.HasOne(d => d.Department).WithMany(p => p.TbSysUsers) + .HasForeignKey(d => d.DepartmentId) + .HasConstraintName("FK_tb_Sys_Users_tb_Sys_Departments"); + + entity.HasOne(d => d.District).WithMany(p => p.TbSysUsers) + .HasForeignKey(d => d.DistrictId) + .HasConstraintName("FK_tb_Sys_Users_tb_Sys_Districts"); + + entity.HasOne(d => d.Role).WithMany(p => p.TbSysUsers) + .HasForeignKey(d => d.RoleId) + .HasConstraintName("FK_tb_Sys_Users_tb_Sys_Roles"); + + entity.HasMany(d => d.Hotels).WithMany(p => p.Users) + .UsingEntity>( + "TbSysUserHotel", + r => r.HasOne().WithMany() + .HasForeignKey("HotelId") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_tb_Sys_UserDepartments_tb_Sys_Departments"), + l => l.HasOne().WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_tb_Sys_UserDepartments_tb_Sys_Users"), + j => + { + j.HasKey("UserId", "HotelId").HasName("PK_tb_Sys_UserDepartments"); + j.ToTable("tb_Sys_UserHotel"); + j.IndexerProperty("UserId").HasColumnName("UserID"); + j.IndexerProperty("HotelId").HasColumnName("HotelID"); + }); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tb_WXMenus"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Class) + .HasMaxLength(30) + .IsUnicode(false); + entity.Property(e => e.Code) + .HasMaxLength(10) + .IsUnicode(false); + entity.Property(e => e.Ename) + .HasMaxLength(50) + .HasColumnName("EName"); + entity.Property(e => e.Name).HasMaxLength(20); + entity.Property(e => e.Twname) + .HasMaxLength(50) + .HasColumnName("TWName"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__tb_WXMes__3214EC279D2D4070"); + + entity.ToTable("tb_WXMessage"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Contact).HasMaxLength(20); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.Message).HasMaxLength(100); + entity.Property(e => e.Remark).HasMaxLength(50); + entity.Property(e => e.RoomNumber).HasMaxLength(20); + entity.Property(e => e.Time).HasColumnType("datetime"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("TBL_SyncList"); + + entity.Property(e => e.OtherTableName).HasMaxLength(50); + entity.Property(e => e.RevisionId).HasColumnName("RevisionID"); + entity.Property(e => e.TableName).HasMaxLength(20); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("Test"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CreateTime).HasMaxLength(255); + entity.Property(e => e.How).HasMaxLength(255); + entity.Property(e => e.MyName).HasMaxLength(64); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("TFTP_set"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.CreateTime).HasMaxLength(64); + entity.Property(e => e.HostId).HasColumnName("HostID"); + entity.Property(e => e.HotelCode).HasMaxLength(64); + entity.Property(e => e.HotelId).HasColumnName("HotelID"); + entity.Property(e => e.RoomNumber).HasMaxLength(128); + entity.Property(e => e.TargetDomain).HasMaxLength(128); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/DAL/New_Models/RoomNoBodyHowToLog.cs b/DAL/New_Models/RoomNoBodyHowToLog.cs new file mode 100644 index 0000000..e3c9c5c --- /dev/null +++ b/DAL/New_Models/RoomNoBodyHowToLog.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class RoomNoBodyHowToLog +{ + public long Id { get; set; } + + public string? MissionKey { get; set; } + + public string? CreateTime { get; set; } +} diff --git a/DAL/New_Models/RoomNobodyHowTo.cs b/DAL/New_Models/RoomNobodyHowTo.cs new file mode 100644 index 0000000..b32590f --- /dev/null +++ b/DAL/New_Models/RoomNobodyHowTo.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class RoomNobodyHowTo +{ + public int Id { get; set; } + + public int? CurrentHotelId { get; set; } + + public int? DelayTime { get; set; } + + public string? How { get; set; } + + public int? Temperature { get; set; } + + public string? CreateTime { get; set; } +} diff --git a/DAL/New_Models/SmartRobotDisableTime.cs b/DAL/New_Models/SmartRobotDisableTime.cs new file mode 100644 index 0000000..0a348ac --- /dev/null +++ b/DAL/New_Models/SmartRobotDisableTime.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class SmartRobotDisableTime +{ + public long? Id { get; set; } + + public int? HostId { get; set; } + + public string? RoomNumber { get; set; } + + public string? HotelCode { get; set; } + + public string? DisableStime { get; set; } + + public string? DisableEtime { get; set; } + + public string? CreateTime { get; set; } + + public string? TargetDomain { get; set; } + + public string? IsTrigger { get; set; } +} diff --git a/DAL/New_Models/TbAlarmSetting.cs b/DAL/New_Models/TbAlarmSetting.cs new file mode 100644 index 0000000..80f6257 --- /dev/null +++ b/DAL/New_Models/TbAlarmSetting.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbAlarmSetting +{ + public int HotelId { get; set; } + + public string Type { get; set; } = null!; + + public string Code { get; set; } = null!; + + public string Name { get; set; } = null!; + + public string? Ename { get; set; } + + public string Value { get; set; } = null!; + + public int Sort { get; set; } + + public string? Color { get; set; } + + public int? ModalTypeId { get; set; } + + /// + /// 声音提示 + /// + public bool? Beep { get; set; } + + /// + /// 是否移动端上应用 + /// + public bool? AppApply { get; set; } +} diff --git a/DAL/New_Models/TbAppHotel.cs b/DAL/New_Models/TbAppHotel.cs new file mode 100644 index 0000000..14dedbf --- /dev/null +++ b/DAL/New_Models/TbAppHotel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbAppHotel +{ + public string Code { get; set; } = null!; + + public string? Value { get; set; } + + public int? Sort { get; set; } + + public string? Remark { get; set; } + + public int? HotelId { get; set; } +} diff --git a/DAL/New_Models/TbAppMenu.cs b/DAL/New_Models/TbAppMenu.cs new file mode 100644 index 0000000..16ca0e4 --- /dev/null +++ b/DAL/New_Models/TbAppMenu.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbAppMenu +{ + public int Id { get; set; } + + public int? HotelId { get; set; } + + public short? Type { get; set; } + + public string? Code { get; set; } + + /// + /// 关联菜单ID + /// + public string Name { get; set; } = null!; + + public string? EnglishName { get; set; } + + public string? Icon { get; set; } + + public string? Url { get; set; } + + public string? Class { get; set; } + + /// + /// 排序 + /// + public int Sort { get; set; } + + /// + /// 启用 + /// + public bool ActiveIndicator { get; set; } +} diff --git a/DAL/New_Models/TbAppRoom.cs b/DAL/New_Models/TbAppRoom.cs new file mode 100644 index 0000000..248f0b0 --- /dev/null +++ b/DAL/New_Models/TbAppRoom.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbAppRoom +{ + public int Id { get; set; } + + /// + /// app mac地址 + /// + public string? Mac { get; set; } + + /// + /// 房号 + /// + public string? RoomNumber { get; set; } + + public int? HotelId { get; set; } +} diff --git a/DAL/New_Models/TbCarbonStatus.cs b/DAL/New_Models/TbCarbonStatus.cs new file mode 100644 index 0000000..42e37ca --- /dev/null +++ b/DAL/New_Models/TbCarbonStatus.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbCarbonStatus +{ + public int Id { get; set; } + + public int? HostId { get; set; } + + public string? Status { get; set; } + + public string? TriggerSource { get; set; } + + public DateTime? CreateTime { get; set; } +} diff --git a/DAL/New_Models/TbFaultRecord.cs b/DAL/New_Models/TbFaultRecord.cs new file mode 100644 index 0000000..09de0bf --- /dev/null +++ b/DAL/New_Models/TbFaultRecord.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbFaultRecord +{ + public int Id { get; set; } + + /// + /// 维修状态:0未维修,1已维修 + /// + public int? Status { get; set; } + + /// + /// 注销:1已注销 + /// + public bool? IsCancel { get; set; } + + /// + /// 故障编号 + /// + public string? Number { get; set; } + + /// + /// 房号 + /// + public string? RoomNumber { get; set; } + + /// + /// 故障类别ID + /// + public int? FaultTypeId { get; set; } + + /// + /// 故障发生时间 + /// + public DateTime? FaultTime { get; set; } + + /// + /// 故障描述 + /// + public string? Description { get; set; } + + /// + /// 登记人 + /// + public string? RegisteredPerson { get; set; } + + /// + /// 登记时间 + /// + public DateTime? RegisteredTime { get; set; } + + /// + /// 维修人 + /// + public string? RepairPerson { get; set; } + + /// + /// 维修时间 + /// + public DateTime? RepairTime { get; set; } + + /// + /// 维修内容 + /// + public string? RepairContent { get; set; } + + /// + /// 注销人 + /// + public string? CancelPerson { get; set; } + + /// + /// 注销时间 + /// + public DateTime? CancelTime { get; set; } + + /// + /// 注销原因 + /// + public string? CancelReason { get; set; } + + public int? HotelId { get; set; } +} diff --git a/DAL/New_Models/TbFaultType.cs b/DAL/New_Models/TbFaultType.cs new file mode 100644 index 0000000..d2bf99e --- /dev/null +++ b/DAL/New_Models/TbFaultType.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbFaultType +{ + public int Id { get; set; } + + /// + /// 故障编号 + /// + public string? Code { get; set; } + + /// + /// 故障名称 + /// + public string? Name { get; set; } + + /// + /// 故障说明 + /// + public string? Remark { get; set; } + + public int? HotelId { get; set; } +} diff --git a/DAL/New_Models/TbGroup.cs b/DAL/New_Models/TbGroup.cs new file mode 100644 index 0000000..2b4af20 --- /dev/null +++ b/DAL/New_Models/TbGroup.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbGroup +{ + public int Id { get; set; } + + public int? ParentId { get; set; } + + public string Name { get; set; } = null!; + + public int Sort { get; set; } + + public int? HotelId { get; set; } + + public virtual ICollection TbHosts { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbHost.cs b/DAL/New_Models/TbHost.cs new file mode 100644 index 0000000..c4f831d --- /dev/null +++ b/DAL/New_Models/TbHost.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHost +{ + public int Id { get; set; } + + public int? HotelId { get; set; } + + /// + /// 主机编号 + /// + public string? HostNumber { get; set; } + + /// + /// 房间号 + /// + public string? RoomNumber { get; set; } + + public string? Ip { get; set; } + + /// + /// 子网掩码 + /// + public string? SubnetMask { get; set; } + + /// + /// 默认网关 + /// + public string? Gateway { get; set; } + + /// + /// 端口 + /// + public int? Port { get; set; } + + public string? Mac { get; set; } + + /// + /// 所属楼层 + /// + public int? GroupId { get; set; } + + /// + /// 房型 + /// + public int? RoomTypeId { get; set; } + + /// + /// 状态 0:离线 1:在线 + /// + public bool? Status { get; set; } + + /// + /// 版本号 + /// + public string? Version { get; set; } + + /// + /// 备注 + /// + public string? Remark { get; set; } + + /// + /// 注册日期 + /// + public DateTime? RegisterDate { get; set; } + + /// + /// 房态 + /// + public int? RoomStatusId { get; set; } + + /// + /// 身份 + /// + public int? RoomCardId { get; set; } + + /// + /// 门锁 + /// + public bool? DoorLockStatus { get; set; } + + public DateTime? DoorLockStatusUpdateTime { get; set; } + + /// + /// 保险箱:0关,1开,2未接保险箱 + /// + public int? SafeStatus { get; set; } + + public short? HostTemp { get; set; } + + public string? ConfigVersion { get; set; } + + public bool? PowerSupply { get; set; } + + public int? AuthorizedHours { get; set; } + + public int? LockStatus { get; set; } + + public float? LockVoltage { get; set; } + + public string? ProductKey { get; set; } + + public string? DeviceName { get; set; } + + public string? DeviceSecret { get; set; } + + public string? IotId { get; set; } + + public bool? IsPublish { get; set; } + + public string? HostSecret { get; set; } + + public string? RokidWebhookUrl { get; set; } + + public string? XiaoDuCuid { get; set; } + + public bool? IsSyncRoomNumber { get; set; } + + public bool? IsAutoUpdate { get; set; } + + public string? Dns { get; set; } + + public string? TclskillId { get; set; } + + public string? Tclcuid { get; set; } + + public string? HuaWeiCuid { get; set; } + + public DateTime? MacbindDate { get; set; } + + public int? Iptype { get; set; } + + public DateTime? ExpireTime { get; set; } + + public string? Season { get; set; } + + public string? ServerIp { get; set; } + + public DateTime? RunTime { get; set; } + + public DateTime? SetExpireTime { get; set; } + + public bool? IsLock { get; set; } + + public int? ServerPort { get; set; } + + public string? LanIp { get; set; } + + public int? LanPort { get; set; } + + public DateTime? LastModifiedTime { get; set; } + + public string? XiaoMiCuid { get; set; } + + public string? Wxvalidate { get; set; } + + public string? Model { get; set; } + + public string? LauncherVersion { get; set; } + + public int? UpgradeStatus { get; set; } + + public DateTime? UpgradeTime { get; set; } + + public int? FrameNo { get; set; } + + public bool? IsDeleted { get; set; } + + public string? TianMaoCuid { get; set; } + + public DateTime? FrameNoTime { get; set; } + + public string? DisableStartTime { get; set; } + + public string? DisableEndTime { get; set; } + + public bool? IsWelcomeDisableTime { get; set; } + + public string? FcsLocationUuid { get; set; } + + public string? HiWeiCuid { get; set; } + + public virtual TbGroup? Group { get; set; } + + public virtual TbSysHotel? Hotel { get; set; } + + public virtual TbRoomCard? RoomCard { get; set; } + + public virtual TbRoomStatus? RoomStatus { get; set; } + + public virtual TbRoomType? RoomType { get; set; } + + public virtual ICollection TbHostUpdateStatuses { get; set; } = new List(); + + public virtual ICollection TbRoomServices { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbHostAir.cs b/DAL/New_Models/TbHostAir.cs new file mode 100644 index 0000000..caa8add --- /dev/null +++ b/DAL/New_Models/TbHostAir.cs @@ -0,0 +1,214 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostAir +{ + public int HostId { get; set; } + + public int RoomTypeAirId { get; set; } + + /// + /// 空调运行状态,0/停止,1/运行 + /// + public bool? Running { get; set; } + + /// + /// 当前温度 + /// + public short? CurrentTemp { get; set; } + + /// + /// 设定温度 + /// + public short? SettingTemp { get; set; } + + /// + /// 风速:0/停止, 1/低速, 2/中速, 3/高速, 4/自动 + /// + public short? Speed { get; set; } + + /// + /// 冷阀门:0关,1开 + /// + public short? ColdValve { get; set; } + + /// + /// 热阀门:0关,1开 + /// + public short? ThermalValve { get; set; } + + /// + /// 保温温度 + /// + public short? KeepTemp { get; set; } + + /// + /// 初始温度 + /// + public short? InitTemp { get; set; } + + /// + /// 最高温度 + /// + public short? HightTemp { get; set; } + + /// + /// 最低温度 + /// + public short? LowerTemp { get; set; } + + /// + /// 死区温度 + /// + public short? DeadTemp { get; set; } + + /// + /// 热 + /// + public short? HotDevition { get; set; } + + /// + /// 冷偏差 + /// + public short? ColdDevition { get; set; } + + /// + /// 欢迎模式时间(分钟) + /// + public short? WelcomeTime { get; set; } + + /// + /// 是否锁定温度 + /// + public bool? IsLockTemp { get; set; } + + /// + /// 锁定温度 + /// + public short? LockTemp { get; set; } + + /// + /// 模式: 1/制冷模式,2/制热模式,4/送风模式,8/除湿模式 + /// + public int? Mode { get; set; } + + /// + /// 阀状态: 0/冷阀开,1/冷阀关,2/热阀开,3/热阀关 + /// + public int? Valve { get; set; } + + /// + /// 空调管制:0/二管制,1/四管制 + /// + public int? ControlType { get; set; } + + /// + /// 补偿温度 + /// + public double? CompensatoryTemp { get; set; } + + /// + /// 是否关联房态 + /// + public bool? RelateRoomStatus { get; set; } + + /// + /// 是否关联门磁 + /// + public bool? RelateDoorContact { get; set; } + + /// + /// 冷热模式:0/手动,1/自动 + /// + public int? ColdHotMode { get; set; } + + /// + /// 冷热转换延时,单位:秒 + /// + public int? ColdHotSwitchDelayTime { get; set; } + + /// + /// 温度到达停止风机运行 + /// + public bool? FanStop { get; set; } + + /// + /// 禁止风机高速运行:0/否,1/是 + /// + public bool? DisableFanHighSpeed { get; set; } + + /// + /// 启用睡眠标志 + /// + public bool? SleepFlag { get; set; } + + /// + /// 睡眠开始时间 + /// + public string? SleepStartTime { get; set; } + + /// + /// 睡眠结束时间 + /// + public string? SleepEndTime { get; set; } + + /// + /// 睡眠模式偏差 + /// + public short? SleepDevition { get; set; } + + /// + /// 睡眠热 + /// + public short? SleepHotDevition { get; set; } + + /// + /// 睡眠冷偏差 + /// + public short? SleepColdDevition { get; set; } + + /// + /// 启动定时 + /// + public bool? TimeFlag { get; set; } + + /// + /// 定时开始时间1 + /// + public string? TimeStartTime1 { get; set; } + + /// + /// 定时结束时间1 + /// + public string? TimeEndTime1 { get; set; } + + /// + /// 定时开始时间2 + /// + public string? TimeStartTime2 { get; set; } + + /// + /// 定时结束时间2 + /// + public string? TimeEndTime2 { get; set; } + + /// + /// 定时开始时间3 + /// + public string? TimeStartTime3 { get; set; } + + /// + /// 定时结束时间3 + /// + public string? TimeEndTime3 { get; set; } + + public int? No { get; set; } + + public string? ModalId { get; set; } + + public int? RoomTypeModalId { get; set; } + + public virtual TbRoomTypeAir RoomTypeAir { get; set; } = null!; +} diff --git a/DAL/New_Models/TbHostAirRecord.cs b/DAL/New_Models/TbHostAirRecord.cs new file mode 100644 index 0000000..6cf074a --- /dev/null +++ b/DAL/New_Models/TbHostAirRecord.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostAirRecord +{ + /// + /// ID + /// + public long Id { get; set; } + + /// + /// 主机ID + /// + public int HostId { get; set; } + + /// + /// 房号 + /// + public string RoomNumber { get; set; } = null!; + + /// + /// 空调序号 + /// + public int AirNo { get; set; } + + /// + /// 温度类型 + /// + public int TempType { get; set; } + + /// + /// 温度值 + /// + public int Temp { get; set; } + + /// + /// 开始时间 + /// + public DateTime StartTime { get; set; } + + /// + /// 结束时间 + /// + public DateTime? EndTime { get; set; } +} diff --git a/DAL/New_Models/TbHostFault.cs b/DAL/New_Models/TbHostFault.cs new file mode 100644 index 0000000..ca211d7 --- /dev/null +++ b/DAL/New_Models/TbHostFault.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostFault +{ + public int Id { get; set; } + + public int HostId { get; set; } + + public string? Address { get; set; } + + public int? AbnormalStatus { get; set; } + + public DateTime? StatusDate { get; set; } + + public int? AbnormalElectricQty { get; set; } + + public DateTime? ElectricQtyDate { get; set; } + + public int? Abnormal3 { get; set; } + + public DateTime? Abnormal3Date { get; set; } + + public int? Abnormal4 { get; set; } + + public DateTime? Abnormal4Date { get; set; } + + public int? Abnormal5 { get; set; } + + public DateTime? Abnormal5Date { get; set; } +} diff --git a/DAL/New_Models/TbHostFaultRecord.cs b/DAL/New_Models/TbHostFaultRecord.cs new file mode 100644 index 0000000..2f4d035 --- /dev/null +++ b/DAL/New_Models/TbHostFaultRecord.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostFaultRecord +{ + public long Id { get; set; } + + public int? HostId { get; set; } + + public string? RoomNumber { get; set; } + + public int? RoomTypeId { get; set; } + + public int? RoomTypeModalId { get; set; } + + public string? ModalAddress { get; set; } + + public int? Type { get; set; } + + public int? Value { get; set; } + + public DateTime? Date { get; set; } +} diff --git a/DAL/New_Models/TbHostModal.cs b/DAL/New_Models/TbHostModal.cs new file mode 100644 index 0000000..e750722 --- /dev/null +++ b/DAL/New_Models/TbHostModal.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostModal +{ + public int HostId { get; set; } + + public int RoomTypeModalId { get; set; } + + /// + /// 状态:0关,1开 + /// + public int Status { get; set; } + + /// + /// 亮度 + /// + public int Brightness { get; set; } + + /// + /// 当天开启时长 + /// + public int Time { get; set; } + + public DateTime? UpdateTime { get; set; } + + public int? CurrentTemp { get; set; } + + public int? SettingTemp { get; set; } + + public int? FanSpeed { get; set; } + + public int? Mode { get; set; } + + public int? Valve { get; set; } + + public virtual TbRoomTypeModal RoomTypeModal { get; set; } = null!; +} diff --git a/DAL/New_Models/TbHostModalEnergy.cs b/DAL/New_Models/TbHostModalEnergy.cs new file mode 100644 index 0000000..3f3aac4 --- /dev/null +++ b/DAL/New_Models/TbHostModalEnergy.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostModalEnergy +{ + /// + /// 主机ID + /// + public int HostId { get; set; } + + /// + /// 房号 + /// + public string RoomNumber { get; set; } = null!; + + public int? RoomTypeId { get; set; } + + /// + /// 回路ID + /// + public int RoomTypeModalId { get; set; } + + public string? ModalAddress { get; set; } + + public string Outlet { get; set; } = null!; + + /// + /// 时间 + /// + public DateOnly Date { get; set; } + + /// + /// 消耗能量 + /// + public double Energy { get; set; } +} diff --git a/DAL/New_Models/TbHostModalRecord.cs b/DAL/New_Models/TbHostModalRecord.cs new file mode 100644 index 0000000..d58c045 --- /dev/null +++ b/DAL/New_Models/TbHostModalRecord.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostModalRecord +{ + /// + /// ID + /// + public long Id { get; set; } + + public int HostId { get; set; } + + public string RoomNumber { get; set; } = null!; + + public int? RoomTypeId { get; set; } + + public int RoomTypeModalId { get; set; } + + public string? ModalAddress { get; set; } + + public DateTime StartTime { get; set; } + + public DateTime? EndTime { get; set; } + + public int? Status { get; set; } + + public virtual TbRoomTypeModal RoomTypeModal { get; set; } = null!; +} diff --git a/DAL/New_Models/TbHostModalRecordsBak.cs b/DAL/New_Models/TbHostModalRecordsBak.cs new file mode 100644 index 0000000..e821020 --- /dev/null +++ b/DAL/New_Models/TbHostModalRecordsBak.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostModalRecordsBak +{ + public long Id { get; set; } + + public int HostId { get; set; } + + public string RoomNumber { get; set; } = null!; + + public int? RoomTypeId { get; set; } + + public int RoomTypeModalId { get; set; } + + public string? ModalAddress { get; set; } + + public DateTime StartTime { get; set; } + + public DateTime? EndTime { get; set; } + + public int? Status { get; set; } +} diff --git a/DAL/New_Models/TbHostRoomCard.cs b/DAL/New_Models/TbHostRoomCard.cs new file mode 100644 index 0000000..05b85ca --- /dev/null +++ b/DAL/New_Models/TbHostRoomCard.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostRoomCard +{ + public long Id { get; set; } + + public int? HostId { get; set; } + + public string? RoomNumber { get; set; } + + public int? RoomCardId { get; set; } + + /// + /// 房卡编号 + /// + public string? CardNumber { get; set; } + + /// + /// 房卡类型ID + /// + public int? CardTypeId { get; set; } + + /// + /// 员工编号 + /// + public string? UserNumber { get; set; } + + /// + /// 员工姓名 + /// + public string? UserName { get; set; } + + public DateTime? InCardTime { get; set; } + + public DateTime? OutCardTime { get; set; } + + public bool? IsAlarm { get; set; } +} diff --git a/DAL/New_Models/TbHostScene.cs b/DAL/New_Models/TbHostScene.cs new file mode 100644 index 0000000..8ff1d46 --- /dev/null +++ b/DAL/New_Models/TbHostScene.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostScene +{ + public int HostId { get; set; } + + public int RoomTypeSceneId { get; set; } + + public int? Status { get; set; } + + public int? Time { get; set; } + + public DateTime? UpdateTime { get; set; } + + public virtual TbRoomTypeScene RoomTypeScene { get; set; } = null!; +} diff --git a/DAL/New_Models/TbHostTimingControl.cs b/DAL/New_Models/TbHostTimingControl.cs new file mode 100644 index 0000000..e109e06 --- /dev/null +++ b/DAL/New_Models/TbHostTimingControl.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostTimingControl +{ + public long Id { get; set; } + + /// + /// 酒店ID + /// + public int HotelId { get; set; } + + /// + /// 主机ID,以逗号隔开 + /// + public string? HostIds { get; set; } + + /// + /// 楼层ID + /// + public int? GroupId { get; set; } + + /// + /// 房型ID + /// + public int? RoomTypeId { get; set; } + + /// + /// 房态ID + /// + public int? RoomStatusId { get; set; } + + /// + /// 房卡类型ID + /// + public int? RoomCardTypeId { get; set; } + + /// + /// 场景ID + /// + public int? RoomTypeSceneId { get; set; } + + /// + /// 定时类型:0每天,1每周,2每月 + /// + public short? TimingType { get; set; } + + /// + /// 具体星期几或几号 + /// + public string? TimingDay { get; set; } + + /// + /// 定时时间(时:分) + /// + public string? Timing { get; set; } + + /// + /// 执行状态:0未执行,1已执行 + /// + public bool? ExecStatus { get; set; } + + /// + /// 执行时间 + /// + public DateTime? ExecTime { get; set; } + + public bool? ActiveIndicator { get; set; } +} diff --git a/DAL/New_Models/TbHostUpdate.cs b/DAL/New_Models/TbHostUpdate.cs new file mode 100644 index 0000000..50fa808 --- /dev/null +++ b/DAL/New_Models/TbHostUpdate.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostUpdate +{ + public int Id { get; set; } + + /// + /// 文件类型:0/主机固件文件,1/配置数据文件 + /// + public int FileType { get; set; } + + /// + /// 升级包名称 + /// + public string FileName { get; set; } = null!; + + /// + /// 路径 + /// + public string Href { get; set; } = null!; + + /// + /// Md5值 + /// + public string? Md5 { get; set; } + + /// + /// 文件大小 + /// + public long? Size { get; set; } + + /// + /// 上传日期 + /// + public DateTime? UploadTime { get; set; } + + /// + /// 上传人 + /// + public string? Account { get; set; } + + public int? HotelId { get; set; } + + public virtual ICollection TbHostUpdateStatuses { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbHostUpdateStatus.cs b/DAL/New_Models/TbHostUpdateStatus.cs new file mode 100644 index 0000000..b383f78 --- /dev/null +++ b/DAL/New_Models/TbHostUpdateStatus.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostUpdateStatus +{ + public int Id { get; set; } + + /// + /// 主机ID + /// + public int HostId { get; set; } + + /// + /// 升级包ID + /// + public int HostUpdateId { get; set; } + + /// + /// 发布时间 + /// + public DateTime? PublishTime { get; set; } + + /// + /// 升级时间 + /// + public DateTime? UpdatedTime { get; set; } + + /// + /// 状态 + /// + public int? Status { get; set; } + + public virtual TbHost Host { get; set; } = null!; + + public virtual TbHostUpdate HostUpdate { get; set; } = null!; +} diff --git a/DAL/New_Models/TbHostWordsReport.cs b/DAL/New_Models/TbHostWordsReport.cs new file mode 100644 index 0000000..51de486 --- /dev/null +++ b/DAL/New_Models/TbHostWordsReport.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostWordsReport +{ + public long Id { get; set; } + + public int HostId { get; set; } + + public string? ModalAddress { get; set; } + + public short? Type { get; set; } + + public string? Sentence { get; set; } + + public DateTime? CreatedDate { get; set; } + + public int? HotelId { get; set; } +} diff --git a/DAL/New_Models/TbHostsRcu.cs b/DAL/New_Models/TbHostsRcu.cs new file mode 100644 index 0000000..1821017 --- /dev/null +++ b/DAL/New_Models/TbHostsRcu.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHostsRcu +{ + public int Id { get; set; } + + public int? HostId { get; set; } + + public string? TypeNumber { get; set; } + + public int? Iptype { get; set; } + + public string? LanIp { get; set; } + + public string? ServerIp { get; set; } + + public string? SubnetMask { get; set; } + + public string? Gateway { get; set; } + + public int? LanPort { get; set; } + + public string? Dns { get; set; } + + public string? Version { get; set; } + + public DateTime? RunTime { get; set; } + + public string? LauncherVersion { get; set; } + + public string? Mac { get; set; } + + public string? HotelCode { get; set; } + + public int? RoomTypeId { get; set; } + + public string? ConfigVersion { get; set; } + + public int? RoomStatusId { get; set; } + + public string? Season { get; set; } + + public int? LockStatus { get; set; } + + public DateTime? ExpireTime { get; set; } + + public DateTime? SetExpireTime { get; set; } + + public string? RoomNumber { get; set; } + + public string? RoomTypeRemark { get; set; } + + public string? RoomRemark { get; set; } + + public string? Core { get; set; } + + public string? Model { get; set; } + + public string? HotelName { get; set; } + + public string? RoomType { get; set; } + + public int? HotelId { get; set; } + + public string? RoomStatus { get; set; } + + public DateTime? UpdateTime { get; set; } + + public int? KeyButton { get; set; } +} diff --git a/DAL/New_Models/TbHotelAirControl.cs b/DAL/New_Models/TbHotelAirControl.cs new file mode 100644 index 0000000..cf1e911 --- /dev/null +++ b/DAL/New_Models/TbHotelAirControl.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHotelAirControl +{ + public int Id { get; set; } + + public int? HotelId { get; set; } + + public int? ConditionType { get; set; } + + public int? Season { get; set; } + + public bool? ActiveIndicator { get; set; } + + public int? Status { get; set; } + + public int? SettingTemp { get; set; } + + public int? Mode { get; set; } + + public int? FanSpeed { get; set; } + + public DateTime? ModifiedDate { get; set; } + + public int? DelayTime { get; set; } +} diff --git a/DAL/New_Models/TbHotelSeason.cs b/DAL/New_Models/TbHotelSeason.cs new file mode 100644 index 0000000..55fc4c1 --- /dev/null +++ b/DAL/New_Models/TbHotelSeason.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbHotelSeason +{ + public int Id { get; set; } + + public int? HotelId { get; set; } + + public int? Month1 { get; set; } + + public int? Month2 { get; set; } + + public int? Month3 { get; set; } + + public int? Month4 { get; set; } + + public int? Month5 { get; set; } + + public int? Month6 { get; set; } + + public int? Month7 { get; set; } + + public int? Month8 { get; set; } + + public int? Month9 { get; set; } + + public int? Month10 { get; set; } + + public int? Month11 { get; set; } + + public int? Month12 { get; set; } + + public bool? IsDeleted { get; set; } + + public virtual TbSysHotel? Hotel { get; set; } +} diff --git a/DAL/New_Models/TbManualVisit.cs b/DAL/New_Models/TbManualVisit.cs new file mode 100644 index 0000000..6c29afb --- /dev/null +++ b/DAL/New_Models/TbManualVisit.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbManualVisit +{ + public long Id { get; set; } + + public string? Name { get; set; } + + public string? CompanyName { get; set; } + + public string? PhoneNumber { get; set; } + + public string? ValidateCode { get; set; } + + public DateTime? CreatedDate { get; set; } +} diff --git a/DAL/New_Models/TbModalType.cs b/DAL/New_Models/TbModalType.cs new file mode 100644 index 0000000..59914e6 --- /dev/null +++ b/DAL/New_Models/TbModalType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbModalType +{ + public int Id { get; set; } + + public string? Name { get; set; } + + public int? HotelId { get; set; } + + public virtual ICollection TbRoomTypeAirs { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbModel.cs b/DAL/New_Models/TbModel.cs new file mode 100644 index 0000000..93898b7 --- /dev/null +++ b/DAL/New_Models/TbModel.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbModel +{ + public int Id { get; set; } + + public int? HotelId { get; set; } + + /// + /// 配置方案名称 + /// + public string Name { get; set; } = null!; + + /// + /// 温度修正值 + /// + public int CorrectedTemp { get; set; } + + /// + /// 到达温度后风机是否保持低速运行 + /// + public bool FanRunStatus { get; set; } + + /// + /// 屋内无人时排气扇状态:0关1开2定时 + /// + public int ExhaustFanStatus { get; set; } + + /// + /// 定时时长(分钟/每小时) + /// + public int ExhausFanTime { get; set; } + + /// + /// 红外延时断电时间(分) + /// + public int InfraredDelayPo { get; set; } + + /// + /// 门磁延时断电时间(秒) + /// + public int DoorDelayPo { get; set; } + + /// + /// 拔卡延时断电时间(秒) + /// + public int PullCardDelayPo { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } = null!; + + /// + /// 编辑时间 + /// + public DateTime ModifiedDate { get; set; } + + /// + /// 应用时间 + /// + public DateTime? ApplyDate { get; set; } + + /// + /// 操作人 + /// + public string? ApplyUser { get; set; } + + /// + /// 所应用的主机ID,以逗号隔开 + /// + public string? Hosts { get; set; } + + public virtual ICollection TbModelDetails { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbModelDetail.cs b/DAL/New_Models/TbModelDetail.cs new file mode 100644 index 0000000..0884332 --- /dev/null +++ b/DAL/New_Models/TbModelDetail.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbModelDetail +{ + /// + /// ID + /// + public int Id { get; set; } + + /// + /// 主表ID + /// + public int ModelId { get; set; } + + /// + /// 状态 + /// + public string ModelStatus { get; set; } = null!; + + /// + /// 开关 + /// + public bool? OnOff { get; set; } + + /// + /// 类型:手动0,自动1 + /// + public bool? ModelType { get; set; } + + /// + /// 速度:停止0,低速1,中速2,高速3 + /// + public int? Speed { get; set; } + + /// + /// 夏季温度 + /// + public int? SummerTemp { get; set; } + + /// + /// 冬季温度 + /// + public int? WinterTemp { get; set; } + + /// + /// 定时控制 + /// + public bool? TimingControl { get; set; } + + /// + /// 定时时长(分钟/每小时) + /// + public int? Timer { get; set; } + + /// + /// 允许用电 + /// + public bool? AllowElectric { get; set; } + + public virtual TbModel Model { get; set; } = null!; +} diff --git a/DAL/New_Models/TbRoomCard.cs b/DAL/New_Models/TbRoomCard.cs new file mode 100644 index 0000000..bca58bc --- /dev/null +++ b/DAL/New_Models/TbRoomCard.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomCard +{ + public int Id { get; set; } + + /// + /// 房卡编号 + /// + public string? CardNumber { get; set; } + + /// + /// 房卡类型ID + /// + public int? CardTypeId { get; set; } + + /// + /// 员工编号 + /// + public string? UserNumber { get; set; } + + /// + /// 员工姓名 + /// + public string? UserName { get; set; } + + /// + /// 排序 + /// + public int Sort { get; set; } + + public int? HotelId { get; set; } + + public virtual ICollection TbHosts { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbRoomCardType.cs b/DAL/New_Models/TbRoomCardType.cs new file mode 100644 index 0000000..cec9669 --- /dev/null +++ b/DAL/New_Models/TbRoomCardType.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomCardType +{ + public int Id { get; set; } + + public string? TypeName { get; set; } + + public string? EtypeName { get; set; } + + public string? TwtypeName { get; set; } + + public int? HotelId { get; set; } +} diff --git a/DAL/New_Models/TbRoomModal.cs b/DAL/New_Models/TbRoomModal.cs new file mode 100644 index 0000000..8bc051a --- /dev/null +++ b/DAL/New_Models/TbRoomModal.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomModal +{ + /// + /// 回路地址 + /// + public string ModalAddress { get; set; } = null!; + + /// + /// 输出口 + /// + public string? Outlet { get; set; } + + /// + /// 名称 + /// + public string? Name { get; set; } + + /// + /// 功率(单位:瓦) + /// + public int? Power { get; set; } + + /// + /// 类型 + /// + public int? Type { get; set; } + + public string? Color { get; set; } + + public int Sort { get; set; } + + public string? ModalId { get; set; } + + public int? Number { get; set; } + + public string? ModalName { get; set; } + + public string? Remark { get; set; } +} diff --git a/DAL/New_Models/TbRoomModalType.cs b/DAL/New_Models/TbRoomModalType.cs new file mode 100644 index 0000000..dbe9149 --- /dev/null +++ b/DAL/New_Models/TbRoomModalType.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomModalType +{ + public int Id { get; set; } + + public string? Cname { get; set; } + + public string? Ename { get; set; } +} diff --git a/DAL/New_Models/TbRoomService.cs b/DAL/New_Models/TbRoomService.cs new file mode 100644 index 0000000..4189acb --- /dev/null +++ b/DAL/New_Models/TbRoomService.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomService +{ + public long Id { get; set; } + + public int HostId { get; set; } + + public string? AlarmType { get; set; } + + /// + /// 服务类型 + /// + public string AlarmCode { get; set; } = null!; + + /// + /// 状态 + /// + public bool? Status { get; set; } + + /// + /// 操作时间 + /// + public DateTime? StartTime { get; set; } + + public virtual TbHost Host { get; set; } = null!; +} diff --git a/DAL/New_Models/TbRoomServiceRecord.cs b/DAL/New_Models/TbRoomServiceRecord.cs new file mode 100644 index 0000000..8590d04 --- /dev/null +++ b/DAL/New_Models/TbRoomServiceRecord.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomServiceRecord +{ + public long Id { get; set; } + + public int HostId { get; set; } + + /// + /// 房号 + /// + public string RoomNumber { get; set; } = null!; + + /// + /// 服务类型 + /// + public string AlarmCode { get; set; } = null!; + + public string? Name { get; set; } + + /// + /// 操作时间 + /// + public DateTime StartTime { get; set; } + + public DateTime? EndTime { get; set; } + + /// + /// 状态 + /// + public bool Status { get; set; } + + /// + /// 操作人 + /// + public string? Account { get; set; } +} diff --git a/DAL/New_Models/TbRoomStatus.cs b/DAL/New_Models/TbRoomStatus.cs new file mode 100644 index 0000000..412ebea --- /dev/null +++ b/DAL/New_Models/TbRoomStatus.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomStatus +{ + /// + /// 类型 + /// + public int Id { get; set; } + + /// + /// 名称 + /// + public string Name { get; set; } = null!; + + /// + /// 名称 + /// + public string? Ename { get; set; } + + public string? Twname { get; set; } + + public string? Color { get; set; } + + /// + /// 排序 + /// + public int Sort { get; set; } + + public int? HotelId { get; set; } + + public virtual ICollection TbHosts { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbRoomStatusAid.cs b/DAL/New_Models/TbRoomStatusAid.cs new file mode 100644 index 0000000..4895585 --- /dev/null +++ b/DAL/New_Models/TbRoomStatusAid.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomStatusAid +{ + /// + /// 类型 + /// + public int Id { get; set; } + + /// + /// 辅助房态名称 + /// + public string Name { get; set; } = null!; + + public string? Ename { get; set; } + + /// + /// 排序 + /// + public int Sort { get; set; } + + /// + /// 启用 + /// + public bool ActiveIndicator { get; set; } + + public int? HotelId { get; set; } +} diff --git a/DAL/New_Models/TbRoomType.cs b/DAL/New_Models/TbRoomType.cs new file mode 100644 index 0000000..8082f68 --- /dev/null +++ b/DAL/New_Models/TbRoomType.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomType +{ + /// + /// ID + /// + public int Id { get; set; } + + public int? HotelId { get; set; } + + /// + /// 房型编号 + /// + public string Code { get; set; } = null!; + + /// + /// 房型名称 + /// + public string Name { get; set; } = null!; + + /// + /// 主机上定义的房型名称 + /// + public string? HostName { get; set; } + + /// + /// 组地址 + /// + public string? GroupAddress { get; set; } + + /// + /// 项目号 + /// + public int? ProjectId { get; set; } + + /// + /// 白天时间 + /// + public string? Day { get; set; } + + public string? Night { get; set; } + + public int? DoorbellTime { get; set; } + + public int? SavingMode { get; set; } + + public string? SavingModeTime { get; set; } + + /// + /// 空调管制:0/二管制,1/四管制 + /// + public int? ControlType { get; set; } + + public string? Content { get; set; } + + /// + /// 上传人 + /// + public string? Uploader { get; set; } + + /// + /// 上传日期 + /// + public DateTime? UploadTime { get; set; } + + public string? ConfigFileName { get; set; } + + public string? ConfigFilePath { get; set; } + + public bool? Default1 { get; set; } + + public DateTime? LastModifiedTime { get; set; } + + public bool? IsDeleted { get; set; } + + public string? RoomHeight { get; set; } + + public string? RoomArea { get; set; } + + public string? RoomHotLossRatio { get; set; } + + public virtual ICollection TbHosts { get; set; } = new List(); + + public virtual ICollection TbRoomTypeAirs { get; set; } = new List(); + + public virtual ICollection TbRoomTypeChannels { get; set; } = new List(); + + public virtual ICollection TbRoomTypeModals { get; set; } = new List(); + + public virtual ICollection TbRoomTypeProgramFiles { get; set; } = new List(); + + public virtual ICollection TbRoomTypeScenes { get; set; } = new List(); + + public virtual ICollection TbRoomTypeWxmenus { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbRoomTypeAir.cs b/DAL/New_Models/TbRoomTypeAir.cs new file mode 100644 index 0000000..185ac75 --- /dev/null +++ b/DAL/New_Models/TbRoomTypeAir.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomTypeAir +{ + /// + /// ID + /// + public int Id { get; set; } + + /// + /// 房型 + /// + public int? RoomTypeId { get; set; } + + /// + /// 类型 + /// + public int? ModalTypeId { get; set; } + + /// + /// 配置名称 + /// + public string? ModalTypeName { get; set; } + + /// + /// 自定义名称 + /// + public string? CustomerName { get; set; } + + /// + /// 英文名称 + /// + public string? EnglishName { get; set; } + + public int Sort { get; set; } + + public virtual TbModalType? ModalType { get; set; } + + public virtual TbRoomType? RoomType { get; set; } + + public virtual ICollection TbHostAirs { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbRoomTypeChannel.cs b/DAL/New_Models/TbRoomTypeChannel.cs new file mode 100644 index 0000000..0a71f7b --- /dev/null +++ b/DAL/New_Models/TbRoomTypeChannel.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomTypeChannel +{ + public int Id { get; set; } + + public int? RoomTypeId { get; set; } + + public int? Code { get; set; } + + public string? Name { get; set; } + + public int? Sort { get; set; } + + public virtual TbRoomType? RoomType { get; set; } +} diff --git a/DAL/New_Models/TbRoomTypeModal.cs b/DAL/New_Models/TbRoomTypeModal.cs new file mode 100644 index 0000000..6a94363 --- /dev/null +++ b/DAL/New_Models/TbRoomTypeModal.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomTypeModal +{ + public int Id { get; set; } + + /// + /// 外键ID + /// + public int RoomTypeId { get; set; } + + /// + /// 回路地址 + /// + public string ModalAddress { get; set; } = null!; + + /// + /// 输出口 + /// + public string? Outlet { get; set; } + + /// + /// 名称 + /// + public string? Name { get; set; } + + /// + /// 英文名称 + /// + public string? EnglishName { get; set; } + + public string? Twname { get; set; } + + /// + /// 功率(单位:瓦) + /// + public int? Power { get; set; } + + /// + /// 类型 + /// + public int? Type { get; set; } + + /// + /// 二级类型 + /// + public int? Subtype { get; set; } + + public bool Default1 { get; set; } + + public int Sort { get; set; } + + /// + /// 是否移动端上应用 + /// + public bool? AppApply { get; set; } + + public string? Color { get; set; } + + public bool? ActiveIndicator { get; set; } + + public bool? WxactiveIndicator { get; set; } + + public int? LowPower { get; set; } + + public bool? OfflineDisplay { get; set; } + + public bool? LowPowerDisplay { get; set; } + + public bool? Beep { get; set; } + + public bool? Abnormal { get; set; } + + public int? SourceType { get; set; } + + public string? AliasName { get; set; } + + public int? MultipleGroupId { get; set; } + + public string? MultipleTclname { get; set; } + + public string? TcldeviceName { get; set; } + + public bool? IsUploadBaoJing { get; set; } + + public virtual TbRoomType RoomType { get; set; } = null!; + + public virtual ICollection TbHostModalRecords { get; set; } = new List(); + + public virtual ICollection TbHostModals { get; set; } = new List(); + + public virtual ICollection TbRoomTypeSceneModals { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbRoomTypeProgramFile.cs b/DAL/New_Models/TbRoomTypeProgramFile.cs new file mode 100644 index 0000000..cf44325 --- /dev/null +++ b/DAL/New_Models/TbRoomTypeProgramFile.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomTypeProgramFile +{ + public int Id { get; set; } + + public int? RoomTypeId { get; set; } + + public int? FileType { get; set; } + + public string? FileName { get; set; } + + public string? Href { get; set; } + + public string? Md5 { get; set; } + + public long? Size { get; set; } + + public DateTime? UploadTime { get; set; } + + public string? Account { get; set; } + + public virtual TbRoomType? RoomType { get; set; } +} diff --git a/DAL/New_Models/TbRoomTypeScene.cs b/DAL/New_Models/TbRoomTypeScene.cs new file mode 100644 index 0000000..0f9b57f --- /dev/null +++ b/DAL/New_Models/TbRoomTypeScene.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomTypeScene +{ + public int Id { get; set; } + + /// + /// 房型ID + /// + public int RoomTypeId { get; set; } + + /// + /// 0.自定义场景 1.指令场景 + /// + public int Type { get; set; } + + /// + /// 场景中文名称 + /// + public string? Name { get; set; } + + /// + /// 是否移动端上应用 + /// + public bool? AppApply { get; set; } + + /// + /// 场景英文名称 + /// + public string? EnglishName { get; set; } + + /// + /// 组地址 + /// + public string? GroupAddress { get; set; } + + public string? Icon { get; set; } + + public int? Sort { get; set; } + + public int? HotelId { get; set; } + + public bool? ActiveIndicator { get; set; } + + public string? Twname { get; set; } + + public bool? TakeInverse { get; set; } + + public string? AliasName { get; set; } + + public virtual TbRoomType RoomType { get; set; } = null!; + + public virtual ICollection TbHostScenes { get; set; } = new List(); + + public virtual ICollection TbRoomTypeSceneModals { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbRoomTypeSceneModal.cs b/DAL/New_Models/TbRoomTypeSceneModal.cs new file mode 100644 index 0000000..a6b4b7c --- /dev/null +++ b/DAL/New_Models/TbRoomTypeSceneModal.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomTypeSceneModal +{ + public int Id { get; set; } + + public int RoomTypeSceneId { get; set; } + + /// + /// 模块ID + /// + public int RoomTypeModalId { get; set; } + + /// + /// 设备状态:0关,1开 + /// + public int? Status { get; set; } + + /// + /// 亮度 + /// + public int? Brightness { get; set; } + + public string? ModalId { get; set; } + + public int? CurrentTemp { get; set; } + + public int? SettingTemp { get; set; } + + public int? FanSpeed { get; set; } + + public int? Mode { get; set; } + + public int? Valve { get; set; } + + public virtual TbRoomTypeModal RoomTypeModal { get; set; } = null!; + + public virtual TbRoomTypeScene RoomTypeScene { get; set; } = null!; +} diff --git a/DAL/New_Models/TbRoomTypeWxmenu.cs b/DAL/New_Models/TbRoomTypeWxmenu.cs new file mode 100644 index 0000000..72a3c50 --- /dev/null +++ b/DAL/New_Models/TbRoomTypeWxmenu.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbRoomTypeWxmenu +{ + public int Id { get; set; } + + public int? RoomTypeId { get; set; } + + public string? Code { get; set; } + + public string? Name { get; set; } + + public string? Ename { get; set; } + + public string? Twname { get; set; } + + public string? Class { get; set; } + + public int? Sort { get; set; } + + public bool? ActiveIndicator { get; set; } + + public bool? TakePower { get; set; } + + public virtual TbRoomType? RoomType { get; set; } +} diff --git a/DAL/New_Models/TbSeason.cs b/DAL/New_Models/TbSeason.cs new file mode 100644 index 0000000..d30e09b --- /dev/null +++ b/DAL/New_Models/TbSeason.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSeason +{ + /// + /// ID + /// + public int Id { get; set; } + + /// + /// 季节名称 + /// + public string Name { get; set; } = null!; + + /// + /// 开始日期 + /// + public string BeginDate { get; set; } = null!; + + /// + /// 结束日期 + /// + public string EndDate { get; set; } = null!; +} diff --git a/DAL/New_Models/TbSysActiveUser.cs b/DAL/New_Models/TbSysActiveUser.cs new file mode 100644 index 0000000..bc8b7ba --- /dev/null +++ b/DAL/New_Models/TbSysActiveUser.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysActiveUser +{ + public long Id { get; set; } + + public string Account { get; set; } = null!; + + public string LoginIp { get; set; } = null!; + + public string SessionId { get; set; } = null!; +} diff --git a/DAL/New_Models/TbSysAuthority.cs b/DAL/New_Models/TbSysAuthority.cs new file mode 100644 index 0000000..0af9c30 --- /dev/null +++ b/DAL/New_Models/TbSysAuthority.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysAuthority +{ + public int Id { get; set; } + + /// + /// 父节点ID + /// + public int ParentId { get; set; } + + /// + /// 名称 + /// + public string Name { get; set; } = null!; + + /// + /// 英文名称 + /// + public string? Ename { get; set; } + + public string? Twname { get; set; } + + /// + /// 权限组 + /// + public string? Url { get; set; } + + public string? Icon { get; set; } + + public bool IsMenu { get; set; } + + /// + /// 排序 + /// + public int Sort { get; set; } + + /// + /// 启用 + /// + public bool ActiveIndicator { get; set; } + + public bool IsLog { get; set; } + + public virtual ICollection Roles { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbSysCity.cs b/DAL/New_Models/TbSysCity.cs new file mode 100644 index 0000000..ef40310 --- /dev/null +++ b/DAL/New_Models/TbSysCity.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysCity +{ + public int Id { get; set; } + + public string ProvinceCode { get; set; } = null!; + + public string? Code { get; set; } + + public string? Name { get; set; } + + public string? Twname { get; set; } + + public string? Ename { get; set; } +} diff --git a/DAL/New_Models/TbSysCounty.cs b/DAL/New_Models/TbSysCounty.cs new file mode 100644 index 0000000..499730e --- /dev/null +++ b/DAL/New_Models/TbSysCounty.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysCounty +{ + public int Id { get; set; } + + public string CityCode { get; set; } = null!; + + public string? Code { get; set; } + + public string? Name { get; set; } + + public string? Twname { get; set; } + + public string? Ename { get; set; } +} diff --git a/DAL/New_Models/TbSysDistrict.cs b/DAL/New_Models/TbSysDistrict.cs new file mode 100644 index 0000000..5ee6306 --- /dev/null +++ b/DAL/New_Models/TbSysDistrict.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysDistrict +{ + public int Id { get; set; } + + /// + /// 代码 + /// + public string Code { get; set; } = null!; + + /// + /// 名称 + /// + public string Name { get; set; } = null!; + + /// + /// 排序 + /// + public int Sort { get; set; } + + /// + /// 备注 + /// + public string? Remark { get; set; } + + /// + /// 上级部门 + /// + public int? ParentId { get; set; } + + /// + /// 启用 + /// + public bool ActiveIndicator { get; set; } + + /// + /// 创建人 + /// + public string CreatedBy { get; set; } = null!; + + /// + /// 创建时间 + /// + public DateTime CreatedDate { get; set; } + + /// + /// 修改人 + /// + public string ModifiedBy { get; set; } = null!; + + /// + /// 修改时间 + /// + public DateTime ModifiedDate { get; set; } + + public virtual ICollection TbSysUsers { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbSysHotel.cs b/DAL/New_Models/TbSysHotel.cs new file mode 100644 index 0000000..67adf48 --- /dev/null +++ b/DAL/New_Models/TbSysHotel.cs @@ -0,0 +1,190 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysHotel +{ + public int Id { get; set; } + + public int? SysHotelGroupId { get; set; } + + /// + /// 酒店代码 + /// + public string Code { get; set; } = null!; + + /// + /// 名称 + /// + public string Name { get; set; } = null!; + + /// + /// 英文名称 + /// + public string Ename { get; set; } = null!; + + public string? Twname { get; set; } + + /// + /// 联系人 + /// + public string? Contact { get; set; } + + /// + /// 联系电话 + /// + public string? Phone { get; set; } + + /// + /// 地址 + /// + public string? Address { get; set; } + + /// + /// 排序 + /// + public int Sort { get; set; } + + /// + /// 备注 + /// + public string? Remark { get; set; } + + /// + /// 上级部门 + /// + public int? ParentId { get; set; } + + /// + /// 启用 + /// + public bool ActiveIndicator { get; set; } + + /// + /// 创建人 + /// + public string CreatedBy { get; set; } = null!; + + /// + /// 创建时间 + /// + public DateTime CreatedDate { get; set; } + + /// + /// 修改人 + /// + public string ModifiedBy { get; set; } = null!; + + /// + /// 修改时间 + /// + public DateTime ModifiedDate { get; set; } + + /// + /// 登录密码 + /// + public string? Wxvalidate { get; set; } + + public string? LogoPath { get; set; } + + public string? Styles { get; set; } + + public string? AssociatedAccount { get; set; } + + public bool? IsAutoGetKey { get; set; } + + public string? WelcomeSpeech { get; set; } + + public string? GoodbyeSpeech { get; set; } + + public string? DomainUrl { get; set; } + + public DateTime? ValidateDate { get; set; } + + public string? TvcontrolUrl { get; set; } + + public string? TvcontrolToken { get; set; } + + public bool? IsSyncPms { get; set; } + + public string? DeviceStatusPushUrl { get; set; } + + public string? FaultPushUrl { get; set; } + + public string? ProvinceCode { get; set; } + + public string? CityCode { get; set; } + + public string? CountyCode { get; set; } + + public int? Status { get; set; } + + public bool? IsApprove { get; set; } + + public DateTime? LastModifiedTime { get; set; } + + public bool? IsVoincePowerOn { get; set; } + + public bool? IsPowerOffResetXiaoDu { get; set; } + + public bool? IsDeleted { get; set; } + + public int? StartDayTime { get; set; } + + public int? EndDayTime { get; set; } + + public bool? FcspushEnable { get; set; } + + public string? SkyworthTvauthCode { get; set; } + + public bool? IsUseSkyworthTv { get; set; } + + public bool? IsUseQianLiMa { get; set; } + + public bool? IsPushPmsdata { get; set; } + + public string? TouSuResponseData { get; set; } + + public bool? IsUseTcltv { get; set; } + + public string? HeTongNumber { get; set; } + + public string? FcsPropertyId { get; set; } + + public string? FcsloginUrl { get; set; } + + public string? FcsloginUserName { get; set; } + + public string? FcsloginPassWord { get; set; } + + public string? FcsCarbonUuid { get; set; } + + public string? FcsSosUuid { get; set; } + + public string? FcsTouSuUuid { get; set; } + + public string? FcsCleanUuid { get; set; } + + public string? FcsTiSongWuPin { get; set; } + + public string? FcsRcuDeviceOffline { get; set; } + + public string? FcsRcuOffline { get; set; } + + public string? FcsRcuOnline { get; set; } + + public string? FcsMenCiClose { get; set; } + + public string? FcsMenCiOpen { get; set; } + + public bool? IsNewVersionProtocol { get; set; } + + public virtual ICollection TbHosts { get; set; } = new List(); + + public virtual ICollection TbHotelSeasons { get; set; } = new List(); + + public virtual ICollection TbSysUsers { get; set; } = new List(); + + public virtual ICollection Users { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbSysHotelGroup.cs b/DAL/New_Models/TbSysHotelGroup.cs new file mode 100644 index 0000000..3f2b122 --- /dev/null +++ b/DAL/New_Models/TbSysHotelGroup.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysHotelGroup +{ + public int Id { get; set; } + + public int? ParentId { get; set; } + + public string? Name { get; set; } + + public int? Sort { get; set; } + + public DateTime? LastModifiedTime { get; set; } + + public bool? IsDeleted { get; set; } +} diff --git a/DAL/New_Models/TbSysOauth2.cs b/DAL/New_Models/TbSysOauth2.cs new file mode 100644 index 0000000..777a442 --- /dev/null +++ b/DAL/New_Models/TbSysOauth2.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysOauth2 +{ + public int Id { get; set; } + + public string? Code { get; set; } + + public string? RedirectUri { get; set; } + + public string? AccessToken { get; set; } + + public int? ExpiresIn { get; set; } + + public string? RefreshToken { get; set; } + + public DateTime? CreatedDate { get; set; } + + public string? Account { get; set; } +} diff --git a/DAL/New_Models/TbSysPosition.cs b/DAL/New_Models/TbSysPosition.cs new file mode 100644 index 0000000..a17b0e2 --- /dev/null +++ b/DAL/New_Models/TbSysPosition.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysPosition +{ + public int Id { get; set; } + + public string? Code { get; set; } + + /// + /// 名称 + /// + public string Name { get; set; } = null!; + + /// + /// 排序 + /// + public int Sort { get; set; } + + /// + /// 备注 + /// + public string? Remark { get; set; } + + /// + /// 启用 + /// + public bool ActiveIndicator { get; set; } + + /// + /// 创建人 + /// + public string CreatedBy { get; set; } = null!; + + /// + /// 创建时间 + /// + public DateTime CreatedDate { get; set; } + + /// + /// 修改人 + /// + public string ModifiedBy { get; set; } = null!; + + /// + /// 修改时间 + /// + public DateTime ModifiedDate { get; set; } +} diff --git a/DAL/New_Models/TbSysProvince.cs b/DAL/New_Models/TbSysProvince.cs new file mode 100644 index 0000000..796e01c --- /dev/null +++ b/DAL/New_Models/TbSysProvince.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysProvince +{ + public int Id { get; set; } + + public string? Code { get; set; } + + public string? Name { get; set; } + + public string? Twname { get; set; } + + public string? Ename { get; set; } +} diff --git a/DAL/New_Models/TbSysRole.cs b/DAL/New_Models/TbSysRole.cs new file mode 100644 index 0000000..0da218f --- /dev/null +++ b/DAL/New_Models/TbSysRole.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysRole +{ + public int Id { get; set; } + + public int? HotelId { get; set; } + + /// + /// 名称 + /// + public string Name { get; set; } = null!; + + /// + /// 排序 + /// + public int Sort { get; set; } + + /// + /// 备注 + /// + public string? Remark { get; set; } + + /// + /// 启用 + /// + public bool ActiveIndicator { get; set; } + + /// + /// 创建人 + /// + public string CreatedBy { get; set; } = null!; + + /// + /// 创建时间 + /// + public DateTime CreatedDate { get; set; } + + /// + /// 修改人 + /// + public string ModifiedBy { get; set; } = null!; + + /// + /// 修改时间 + /// + public DateTime ModifiedDate { get; set; } + + public int? SysHotelGroupId { get; set; } + + public virtual ICollection TbSysUsers { get; set; } = new List(); + + public virtual ICollection Authorities { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbSysSeek.cs b/DAL/New_Models/TbSysSeek.cs new file mode 100644 index 0000000..387eb29 --- /dev/null +++ b/DAL/New_Models/TbSysSeek.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysSeek +{ + public int Id { get; set; } + + public string? Prefix { get; set; } + + public int? Suffix { get; set; } + + public string? Remark { get; set; } +} diff --git a/DAL/New_Models/TbSysSetting.cs b/DAL/New_Models/TbSysSetting.cs new file mode 100644 index 0000000..6e6c33d --- /dev/null +++ b/DAL/New_Models/TbSysSetting.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysSetting +{ + public int Id { get; set; } + + /// + /// 分类 + /// + public string? Type { get; set; } + + /// + /// 分类 + /// + public string? Etype { get; set; } + + /// + /// 名称 + /// + public string? Name { get; set; } + + /// + /// 值 + /// + public string? Value { get; set; } + + public string? Remark { get; set; } + + public string? Eremark { get; set; } + + /// + /// 是否允许界面编辑 + /// + public bool AllowEdit { get; set; } +} diff --git a/DAL/New_Models/TbSysSystemLog.cs b/DAL/New_Models/TbSysSystemLog.cs new file mode 100644 index 0000000..2f792f5 --- /dev/null +++ b/DAL/New_Models/TbSysSystemLog.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysSystemLog +{ + /// + /// id + /// + public long Id { get; set; } + + /// + /// 用户名 + /// + public string? Account { get; set; } + + /// + /// 权限模块ID + /// + public int? AuthorityId { get; set; } + + /// + /// 动作 + /// + public string? Action { get; set; } + + /// + /// 明细 + /// + public string? Detail { get; set; } + + /// + /// 结果 + /// + public string? Result { get; set; } + + /// + /// IP地址 + /// + public string? Ip { get; set; } + + /// + /// 操作日期 + /// + public DateTime? Time { get; set; } + + public int? HotelId { get; set; } +} diff --git a/DAL/New_Models/TbSysUser.cs b/DAL/New_Models/TbSysUser.cs new file mode 100644 index 0000000..a79adc9 --- /dev/null +++ b/DAL/New_Models/TbSysUser.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbSysUser +{ + /// + /// ID + /// + public int Id { get; set; } + + public int? HotelId { get; set; } + + /// + /// 登录账号 + /// + public string Account { get; set; } = null!; + + /// + /// 登录密码 + /// + public string Password { get; set; } = null!; + + /// + /// 姓名 + /// + public string? Name { get; set; } + + public int? DistrictId { get; set; } + + /// + /// 所属部门 + /// + public int? DepartmentId { get; set; } + + public int? PositionId { get; set; } + + public int? RoleId { get; set; } + + public string? Sex { get; set; } + + public string? Phone { get; set; } + + /// + /// 邮件 + /// + public string? Email { get; set; } + + /// + /// 排序 + /// + public int Sort { get; set; } + + /// + /// 备注 + /// + public string? Remark { get; set; } + + /// + /// 启用 + /// + public bool ActiveIndicator { get; set; } + + /// + /// 创建人 + /// + public string CreatedBy { get; set; } = null!; + + /// + /// 创建时间 + /// + public DateTime CreatedDate { get; set; } + + /// + /// 修改人 + /// + public string ModifiedBy { get; set; } = null!; + + /// + /// 修改时间 + /// + public DateTime ModifiedDate { get; set; } + + /// + /// 所属分组ID + /// + public int? GroupId { get; set; } + + public string? LoginIp { get; set; } + + public int? SysHotelGroupId { get; set; } + + public string? Password2 { get; set; } + + public DateTime? LastModifiedTime { get; set; } + + public bool? IsDeleted { get; set; } + + public virtual TbSysHotel? Department { get; set; } + + public virtual TbSysDistrict? District { get; set; } + + public virtual TbSysRole? Role { get; set; } + + public virtual ICollection Hotels { get; set; } = new List(); +} diff --git a/DAL/New_Models/TbWxmenu.cs b/DAL/New_Models/TbWxmenu.cs new file mode 100644 index 0000000..4fb5222 --- /dev/null +++ b/DAL/New_Models/TbWxmenu.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbWxmenu +{ + public int Id { get; set; } + + public string? Code { get; set; } + + public string? Name { get; set; } + + public string? Ename { get; set; } + + public string? Twname { get; set; } + + public string? Class { get; set; } + + public int? Sort { get; set; } +} diff --git a/DAL/New_Models/TbWxmessage.cs b/DAL/New_Models/TbWxmessage.cs new file mode 100644 index 0000000..3b73a04 --- /dev/null +++ b/DAL/New_Models/TbWxmessage.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TbWxmessage +{ + public int Id { get; set; } + + public int? HotelId { get; set; } + + public string? RoomNumber { get; set; } + + public string? Message { get; set; } + + public string? Contact { get; set; } + + public DateTime? Time { get; set; } + + public bool? IsRead { get; set; } + + public string? Remark { get; set; } +} diff --git a/DAL/New_Models/TblSyncList.cs b/DAL/New_Models/TblSyncList.cs new file mode 100644 index 0000000..c5c137d --- /dev/null +++ b/DAL/New_Models/TblSyncList.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TblSyncList +{ + public int Id { get; set; } + + public string? TableName { get; set; } + + public string? OtherTableName { get; set; } + + public int RevisionId { get; set; } +} diff --git a/DAL/New_Models/Test.cs b/DAL/New_Models/Test.cs new file mode 100644 index 0000000..95afb21 --- /dev/null +++ b/DAL/New_Models/Test.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class Test +{ + public int Id { get; set; } + + public string? MyName { get; set; } + + public string? How { get; set; } + + public int? Temperature { get; set; } + + public string? CreateTime { get; set; } +} diff --git a/DAL/New_Models/TftpSet.cs b/DAL/New_Models/TftpSet.cs new file mode 100644 index 0000000..20e93a8 --- /dev/null +++ b/DAL/New_Models/TftpSet.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace DAL.New_Models; + +public partial class TftpSet +{ + public int Id { get; set; } + + public int? HotelId { get; set; } + + public string? HotelCode { get; set; } + + public int? HostId { get; set; } + + public string? RoomNumber { get; set; } + + public int? TargerPort { get; set; } + + public string? TargetDomain { get; set; } + + public int? LastTime { get; set; } + + public byte? IsTrigger { get; set; } + + public string? CreateTime { get; set; } + + public int? TargetPort { get; set; } +} diff --git a/Faster/Faster.csproj b/Faster/Faster.csproj new file mode 100644 index 0000000..94c86b5 --- /dev/null +++ b/Faster/Faster.csproj @@ -0,0 +1,14 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + diff --git a/Faster/Program.cs b/Faster/Program.cs new file mode 100644 index 0000000..bc36ed6 --- /dev/null +++ b/Faster/Program.cs @@ -0,0 +1,28 @@ +using FASTER.core; + +namespace Faster +{ + internal class Program + { + static void Main(string[] args) + { + using var settings = new FasterKVSettings("c:/temp"); // backing storage device + using var store = new FasterKV(settings); + + // Create a session per sequence of interactions with FASTER + // We use default callback functions with a custom merger: RMW merges input by adding it to value + using var session = store.NewSession(new SimpleFunctions((a, b) => a + b)); + + long key = 1, value = 1, input = 10, output = 0; + + // Upsert and Read + session.Upsert(ref key, ref value); + session.Read(ref key, ref output); + + // Read-Modify-Write (add input to value) + session.RMW(ref key, ref input); + session.RMW(ref key, ref input, ref output); + Console.WriteLine("Hello, World!"); + } + } +} diff --git a/MyFaster/LengRe.cs b/MyFaster/LengRe.cs new file mode 100644 index 0000000..b9d26d4 --- /dev/null +++ b/MyFaster/LengRe.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FASTER.core; + +namespace MyFaster +{ + public class LengRe + { + public void AAA() + { + // 创建存储设备(混合内存+磁盘) + var logDevice = Devices.CreateLogDevice("colddata.log"); // 冷数据存储到磁盘 + var logSettings = new LogSettings + { + LogDevice = logDevice, + MemorySizeBits = 20, // 1MB 内存(热数据区) + PageSizeBits = 16 // 64KB 磁盘页 + }; + + // 创建 FASTER 实例 + var store = new FasterKV( + size: 1 << 16, // 哈希表大小 + logSettings: logSettings + ); + + // 创建会话 + var session = store.NewSession(new SimpleFunctions()); + + // 写入数据(自动处理热/冷数据) + Key key = new Key { Id = 1 }; + Value value = new Value { Data = "示例数据", LastAccessed = DateTime.UtcNow }; + + session.Upsert(ref key, ref value); + + // 读取数据(热数据在内存,冷数据从磁盘加载) + Value output = default; + Status status = session.Read(ref key, ref output); + + Console.WriteLine($"读取数据: {output.Data}"); + Console.WriteLine($"最后访问: {output.LastAccessed}"); + + // 更新访问时间(保持数据热度) + output.LastAccessed = DateTime.UtcNow; + session.Upsert(ref key, ref output); + + + + + + + + // 填充测试数据 + for (int i = 0; i < 1000; i++) + { + Key k = new Key { Id = i }; + Value v = new Value { Data = $"Item-{i}", LastAccessed = DateTime.UtcNow }; + session.Upsert(ref k, ref v); + } + + // 访问部分数据保持热度 + for (int i = 0; i < 10; i++) // 频繁访问前10条 + { + Key k = new Key { Id = i }; + Value v = default; + session.Read(ref k, ref v); + v.LastAccessed = DateTime.UtcNow; + session.Upsert(ref k, ref v); + } + + // 此时: + // - 前10条是热数据(在内存) + // - 其余990条是冷数据(在磁盘) + + + + + + } + + public void Read() + { + } + } + public struct Key : IEquatable + { + public int Id; + public bool Equals(Key other) => Id == other.Id; + } + + public struct Value + { + public string Data; + public DateTime LastAccessed; + } +} diff --git a/MyFaster/MyFaster.csproj b/MyFaster/MyFaster.csproj new file mode 100644 index 0000000..3d5ff05 --- /dev/null +++ b/MyFaster/MyFaster.csproj @@ -0,0 +1,17 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + + diff --git a/MyFaster/MyFun.cs b/MyFaster/MyFun.cs new file mode 100644 index 0000000..97eb026 --- /dev/null +++ b/MyFaster/MyFun.cs @@ -0,0 +1,98 @@ +using FASTER.core; + +// 定义数据结构 +public struct MyKey : IEquatable +{ + public int Id; + public bool Equals(MyKey other) => Id == other.Id; + public override int GetHashCode() => Id.GetHashCode(); +} + +public struct MyValue +{ + public byte[] Data; + public DateTime Timestamp; +} + +public struct MyInput +{ + public byte[] NewData; +} + +public struct MyOutput +{ + public MyValue Value; + public bool Updated; +} + +public struct MyContext +{ + public string OperationId; + public DateTime StartTime; +} + +// 实现自定义 Functions +public class MyCustomFunctions : FunctionsBase +{ + // 读取完成回调 + public override void ReadCompletionCallback(ref MyKey key, ref MyInput input, ref MyOutput output, MyContext ctx, Status status, RecordMetadata recordMetadata) + { + base.ReadCompletionCallback(ref key, ref input, ref output, ctx, status, recordMetadata); + } + + + //// 写入完成回调 + //public override void UpsertCompletionCallback( + // ref MyKey key, ref MyValue value, MyContext ctx) + //{ + // Console.WriteLine($"Upsert completed for key {key.Id}"); + //} + + //// 删除完成回调 + //public override void DeleteCompletionCallback( + // ref MyKey key, MyContext ctx) + //{ + // Console.WriteLine($"Delete completed for key {key.Id}"); + //} + + //// RMW (Read-Modify-Write) 操作 - 核心功能! + //public override void RMWCompletionCallback( + // ref MyKey key, ref MyInput input, ref MyOutput output, + // MyContext ctx, Status status) + //{ + // if (status == Status.OK) + // { + // Console.WriteLine($"RMW completed for key {key.Id}"); + // } + //} + + //// 并发控制:当多个线程同时修改相同键时调用 + //public override bool ConcurrentWriter( + // ref MyKey key, ref MyValue value, ref MyValue newValue) + //{ + // // 返回 true 表示接受新值,false 表示拒绝 + // return newValue.Timestamp > value.Timestamp; + //} + + //// 读取时复制:允许在读取时修改返回值 + //public override bool SingleReader( + // ref MyKey key, ref MyInput input, ref MyValue value, ref MyOutput dst) + //{ + // dst.Value = value; + // dst.Updated = false; + // return true; + //} + + //// 写入时处理:自定义写入逻辑 + //public override bool ConcurrentWriter( + // ref MyKey key, ref MyValue value, ref MyValue newValue) + //{ + // // 只有新数据的时间戳更晚时才更新 + // if (newValue.Timestamp > value.Timestamp) + // { + // value = newValue; + // return true; + // } + // return false; + //} +} diff --git a/MyFaster/Program.cs b/MyFaster/Program.cs new file mode 100644 index 0000000..1ecec98 --- /dev/null +++ b/MyFaster/Program.cs @@ -0,0 +1,108 @@ +using System.Diagnostics; +using System.Net; +using FASTER.core; +using MemoryPack; + +namespace MyFaster +{ + [MemoryPackable()] + public partial class MyData + { + public string? FirstName { get; set; } + public string? LastName { get; set; } + public int Age { get; set; } + public string? DetailData { get; set; } + } + internal class Program + { + public static byte[] Serialize(T obj) + { + return MemoryPackSerializer.Serialize(obj); + } + + public static T Deserialize(byte[] data) + { + return MemoryPackSerializer.Deserialize(data); + } + + public class MyValueSerializer1 : BinaryObjectSerializer + { + public override void Serialize(ref MyData value) + { + writer.Write(value.FirstName); + writer.Write(value.LastName); + writer.Write(value.Age); + writer.Write(value.DetailData); + } + + public override void Deserialize(out MyData value) + { + value = new MyData + { + FirstName = reader.ReadString(), + LastName = reader.ReadString(), + Age = reader.ReadInt32(), + DetailData = reader.ReadString() + }; + } + } + + public class MyValueSerializer : BinaryObjectSerializer + { + public override void Serialize(ref MyData value) + { + //writer.Write(IPAddress.HostToNetworkOrder(Q.Length)); // 4字节长度头 + var Q = MemoryPackSerializer.Serialize(value); + writer.Write(Q.Length); // 4字节长度头 + writer.Write(Q); + } + + public override void Deserialize(out MyData value) + { + int length = reader.ReadInt32(); // 读长度头 + byte[] buffer = reader.ReadBytes(length); // 读数据体 + value = MemoryPackSerializer.Deserialize(buffer); // 反序列化 + } + } + + static async Task Main(string[] args) + { + using var settings = new FasterKVSettings() + { + LogDevice = Devices.CreateLogDevice("c:/mytemp/log"), // 元数据日志 + ObjectLogDevice = Devices.CreateLogDevice("c:/mytemp/obj"), // 对象数据日志 + TryRecoverLatest = true, + ValueSerializer = () => new MyValueSerializer() + }; + using var store = new FasterKV(settings); + using var session = store.NewSession(new SimpleFunctions()); + + MyData mydata0 = new MyData() { FirstName = "1", LastName = "fdfdf", DetailData = "detail1" }; + MyData mydata1 = new MyData() { FirstName = "1", LastName = "fdfdf", DetailData = "detail1" }; + MyData mydata2 = new MyData() { FirstName = "1", LastName = "fdfdf", DetailData = "detail1" }; + + string mma0 = "a"; + string mma1 = "b"; + string mma2 = "c"; + + session.Upsert(ref mma0, ref mydata0); + session.Upsert(ref mma1, ref mydata1); + session.Upsert(ref mma2, ref mydata2); + + session.CompletePending(true); + // 创建增量检查点(性能更好) + await store.TakeHybridLogCheckpointAsync(CheckpointType.FoldOver); + + // 方法1:完整检查点(推荐) + await store.TakeFullCheckpointAsync(CheckpointType.Snapshot); + + //完整检查点 + await store.TakeFullCheckpointAsync(CheckpointType.FoldOver); + + MyData output = null; + var status = session.Read(ref mma0, ref output); + + Console.WriteLine("Hello, World!"); + } + } +} diff --git a/MyFunctioncache/MyFunctioncache.csproj b/MyFunctioncache/MyFunctioncache.csproj new file mode 100644 index 0000000..53030d9 --- /dev/null +++ b/MyFunctioncache/MyFunctioncache.csproj @@ -0,0 +1,14 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + diff --git a/MyFunctioncache/Program.cs b/MyFunctioncache/Program.cs new file mode 100644 index 0000000..4a14fd6 --- /dev/null +++ b/MyFunctioncache/Program.cs @@ -0,0 +1,41 @@ +using ZiggyCreatures.Caching.Fusion; + +namespace MyFunctioncache +{ + internal class Program + { + static void Main(string[] args) + { + var entryOptions = new FusionCacheEntryOptions().SetDuration(TimeSpan.FromMinutes(10)); + + // 创建缓存实例 + var cache = new FusionCache(new FusionCacheOptions() + { + DefaultEntryOptions = new FusionCacheEntryOptions + { + Duration = TimeSpan.FromMinutes(5) // 默认缓存5分钟 + } + }); + // 设置缓存值 + cache.Set("product_123", new PersonInfo {UserName="aaa"}); + + // 获取缓存值 + var product = cache.TryGet("product_123"); + + // 删除缓存项 + cache.Remove("product_123"); + Console.WriteLine("Hello, World!"); + } + } + + public class PersonInfo + { + public string UserName { get; set; } + + public int Age { get; set; } + + public string Nationality { get; set; } + + public string CacheMsg { get; set; } + } +} diff --git a/UseSQLQueryData/.config/dotnet-tools.json b/UseSQLQueryData/.config/dotnet-tools.json new file mode 100644 index 0000000..fa9cd18 --- /dev/null +++ b/UseSQLQueryData/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "9.0.7", + "commands": [ + "dotnet-ef" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/UseSQLQueryData/Controllers/BaoYiController.cs b/UseSQLQueryData/Controllers/BaoYiController.cs new file mode 100644 index 0000000..2d1500c --- /dev/null +++ b/UseSQLQueryData/Controllers/BaoYiController.cs @@ -0,0 +1,209 @@ +using Common; +using CommonEntity; +using DAL.New_Models; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.VisualBasic; +using Newtonsoft.Json; + +namespace UseSQLQueryData.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class BaoYiController : ControllerBase + { + public static string TimerReportData = "TimerReportData"; + public RicsContext db { get; set; } + public IMemoryCache _memorycache { get; set; } + public BaoYiController(RicsContext context, IMemoryCache cache) + { + this.db = context; + this._memorycache = cache; + } + [HttpPost()] + public async Task SaveRoomTypeModal() + { + + ReturnInfo r = new ReturnInfo(); + try + { + using var reader = new StreamReader(Request.Body); + string jsonString = await reader.ReadToEndAsync(); + + var userlist = Newtonsoft.Json.JsonConvert.DeserializeObject>(jsonString); + var QQQ = userlist.GroupBy(A => A.roomTypeID).Select(A => A.Key); + + using var tran = this.db.Database.BeginTransaction(); + int roomTypeID = 0; + foreach (var item in QQQ) + { + roomTypeID = item; + await db.TbRoomTypeModals.Where(A => A.RoomTypeId == item).ExecuteDeleteAsync(); + } + + var roomType = db.TbRoomTypes.Find(roomTypeID); + + foreach (var item in userlist) + { + var id = item.id; + var modalAddress = item.modalAddress; ; + var outlet = item.outlet; + var name = item.name; + var englishName = item.englishName; + var power = item.power; + var twName = item.twName; + var aliasName = item.aliasName; + var type = item.type; + var sort = item.sort; + var color = item.color; + + var OfflineDisplay = item.OfflineDisplay; + + var LowPower = item.LowPower; + //低电保存显示 + var LowPowerDisplay = item.LowPowerDisplay; + + //是否声音报警 + var Beep = item.Beep; + //是否异常判断 + var Abnormal = item.Abnormal; + + var MultipleGroupID = item.MultipleGroupID; + var MultipleTCLName = item.MultipleTCLName; + var TCLDeviceName = item.TCLDeviceName; + var WXActiveIndicator = item.WXActiveIndicator; + var ActiveIndicator = item.ActiveIndicator; + + var roomTypeModal = new TbRoomTypeModal(); + roomTypeModal.RoomType = roomType; + roomTypeModal.ModalAddress = modalAddress; + roomTypeModal.Outlet = outlet; + roomTypeModal.Name = name; + roomTypeModal.EnglishName = englishName; + roomTypeModal.Twname = twName; + roomTypeModal.AliasName = aliasName; + roomTypeModal.Power = power; + roomTypeModal.Default1 = false; + roomTypeModal.Type = (int)type; + roomTypeModal.Subtype = null; + roomTypeModal.Sort = sort; + roomTypeModal.Color = color; + roomTypeModal.ActiveIndicator = ActiveIndicator;//新增时默认显示 + roomTypeModal.WxactiveIndicator = true;//只要显示,微信默认允许控制 + roomTypeModal.OfflineDisplay = OfflineDisplay; + roomTypeModal.LowPowerDisplay = LowPowerDisplay; + roomTypeModal.Beep = Beep; + roomTypeModal.Abnormal = Abnormal; + + + roomTypeModal.SourceType = 0; + roomTypeModal.MultipleTclname = MultipleTCLName; + roomTypeModal.TcldeviceName = TCLDeviceName; + roomTypeModal.IsUploadBaoJing = item.IsUploadBaoJing; + int a = 0; + int.TryParse(MultipleGroupID, out a); + roomTypeModal.MultipleGroupId = a; + + + db.TbRoomTypeModals.Add(roomTypeModal); + UpdateHostModals(roomTypeModal); + } + await db.SaveChangesAsync(); + await this.db.Database.CommitTransactionAsync(); + + var TBL = db.TbHosts.Where(A => A.RoomTypeId == roomTypeID).Select(A => A.Id); + foreach (var item in TBL) + { + CSRedisCacheHelper.Del_Partition("TimerReportData_" + item, 3); + } + r.isok = true; + } + catch (Exception ex) + { + r.message = ex.Message + "\r\n" + ex.StackTrace; + r.isok = false; + } + return r; + } + + private void UpdateHostModals(TbRoomTypeModal roomTypeModal) + { + if (roomTypeModal.RoomType == null) + { + return; + } + //List hosts = HostManager.LoadAll().Where(t => t.RoomType.ID == roomTypeModal.RoomType.ID).ToList(); + List hosts = db.TbHosts.Where(A => A.RoomType != null && A.RoomType.Id == roomTypeModal.RoomType.Id).ToList(); + foreach (TbHost host in hosts)//该房型下所有主机关联回路 + { + //var hostModal = HostModalManager.GetByModalAddress(host.ID, roomTypeModal.ModalAddress); + var hostModal = db.TbHostModals.FirstOrDefault(A => A.HostId == host.Id && A.RoomTypeModal.ModalAddress.Equals(roomTypeModal.ModalAddress)); + if (null == hostModal) + { + //HostModalManager.Save(new HostModal { HostID = host.ID, Modal = roomTypeModal, Status = 2, Time = 0, UpdateTime = DateTime.Now }); + var n = new TbHostModal() { HostId = host.Id, RoomTypeModal = roomTypeModal, Status = 2, Time = 0, UpdateTime = DateTime.Now }; + db.TbHostModals.Add(n); + } + } + } + + [HttpPost()] + public void CacheTest_Add() + { + _memorycache.Set("A", "aaaa", DateTimeOffset.Now.AddMinutes(10)); + } + [HttpPost()] + public string CacheTest() + { + _memorycache.TryGetValue("A", out string AAA); + return AAA; + } + } + + + public class BaoYiModel + { + public int id { get; set; } + public int roomTypeID { get; set; } + public string modalAddress { get; set; } + public string outlet { get; set; } + public string name { get; set; } + public string englishName { get; set; } + public int power { get; set; } + public string twName { get; set; } + public string aliasName { get; set; } + public DeviceType type { get; set; } + public int sort { get; set; } + public string color { get; set; } + + public int LowPower { get; set; } + //离线保存显示 + public bool OfflineDisplay { get; set; } + + /// + /// 是否低电显示 + /// + public bool LowPowerDisplay { get; set; } + + public bool Beep { get; set; } + /// + /// 是否异常判断 + /// + public virtual bool Abnormal { get; set; } + + + + public bool WXActiveIndicator { get; set; } + public bool ActiveIndicator { get; set; } + public string? MultipleGroupID { get; set; } + public string? MultipleTCLName { get; set; } + public string? TCLDeviceName { get; set; } + + /// + /// 是否上传到宝镜 + /// + public bool IsUploadBaoJing { get; set; } + } +} diff --git a/UseSQLQueryData/Controllers/HiWeiController.cs b/UseSQLQueryData/Controllers/HiWeiController.cs new file mode 100644 index 0000000..1b1a22e --- /dev/null +++ b/UseSQLQueryData/Controllers/HiWeiController.cs @@ -0,0 +1,164 @@ +using System.Net; +using System.Text; +using Common; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using NLog; +using RestSharp; + +namespace UseSQLQueryData.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class HiWeiController : ControllerBase + { + + public static string HiWeiKey = "HiWei_"; + public static int ExpireTimer = 60 * 3; + public string? HiWeiAppId { get; set; } + public string? HiWeiAppSecret { get; set; } + + public IConfiguration ConfigurationBuilder { get; set; } + + + public static Logger logger = NLog.LogManager.GetCurrentClassLogger(); + public HiWeiController(IConfiguration config) + { + this.ConfigurationBuilder = config; + HiWeiAppId = config["HiWeiAppId"]; + HiWeiAppSecret = config["HiWeiAppSecret"]; + } + + [HttpGet()] + //public ReturnInfo HiWeiOAuthRequest(string response_type, string client_id, string client_secret, string redirect_uri) + public ReturnInfo HiWeiOAuthRequest(string? response_type, string? client_id, string? client_secret, string? redirect_uri, string? code, string? refresh_token) + { + + ReturnInfo returninfo = new ReturnInfo(); + try + { + //code wijsv8hf5izejkny 6c1014dab24c41369068d12e4f7e145c http://tvos.hw-iot.com.cn/voice-service/token/auth/SKG9ZSC3| + logger.Error("Data:" + response_type + " " + client_id + " " + client_secret + " " + redirect_uri); + Random r = new Random(); + int newcode = r.Next(1, 10000); + string id = HiWeiAppId; + string secret = HiWeiAppSecret; + string Key = HiWeiKey + newcode; + if (response_type.Equals("code") && client_id.Equals(id) && client_secret.Equals(secret)) + { + var t1 = Guid.NewGuid().ToString(); + var t2 = Guid.NewGuid().ToString(); + + var t3 = Guid.NewGuid().ToString(); + var t4 = Guid.NewGuid().ToString(); + var token = Convert.ToBase64String(Encoding.UTF8.GetBytes(t1 + "###" + t2)); + var reftoken = Convert.ToBase64String(Encoding.UTF8.GetBytes(t3 + "###" + t4)); + + HiWeiToken g = new HiWeiToken(); + g.access_token = token; + g.refresh_token = reftoken; + g.expires_in = new TimeSpan(20, 0, 0).TotalSeconds; + + CSRedisCacheHelper.redis3.Set(Key, g, ExpireTimer); + CSRedisCacheHelper.redis3.Set(refresh_token, g, ExpireTimer); + + var client1 = new RestClient(redirect_uri); + var request1 = new RestRequest("", Method.Get); + request1.AddQueryParameter("code", newcode); + + var QQQ = client1.Execute(request1); + var content = QQQ.Content; + logger.Error("返回的数据为:" + content); + HttpStatusCode HHH = QQQ.StatusCode; + } + else + { + returninfo.isok = false; + returninfo.message = "没有授权"; + } + Dictionary codere = new Dictionary(); + codere.Add("code", newcode); + returninfo.isok = true; + returninfo.response = codere; + + } + catch (Exception ex) + { + returninfo.isok = false; + returninfo.message = ex.Message; + } + return returninfo; + } + + [HttpGet()] + public object mytoken(string code) + { + + return "aaaaa"; + } + + [HttpPost()] + public object gettoken([FromBody] Data data) + { + //ReturnInfo re = new ReturnInfo(); + + try + { + + var ttt = System.Text.Json.JsonSerializer.Serialize(data); + logger.Error("获取token:" + ttt); + string grant_type = data.grant_type; + string code = data.code; + + if (grant_type.Equals("authorization_code")) + { + logger.Error("code: " + code); + string Key = HiWeiKey + code; + var hi = CSRedisCacheHelper.redis3.Get(Key); + + if (hi != null) + { + logger.Error("返回了"); + return hi; + } + else + { + logger.Error("没有获取到"); + return null; + } + } + else if (grant_type.Equals("refresh_token")) + { + var hi = CSRedisCacheHelper.redis3.Get("11111232323"); + if (hi != null) + { + return hi; + } + else + { + return hi; + } + } + return null; + } + catch (Exception ex) + { + return null; + } + } + } + public class Data + { + public string code { get; set; } + public string grant_type { get; set; } + public string client_secret { get; set; } + public string client_id { get; set; } + + } + public class HiWeiToken + { + public string access_token { get; set; } + public string refresh_token { get; set; } + public double expires_in { get; set; } + } +} diff --git a/UseSQLQueryData/Controllers/IISController.cs b/UseSQLQueryData/Controllers/IISController.cs new file mode 100644 index 0000000..1c18e13 --- /dev/null +++ b/UseSQLQueryData/Controllers/IISController.cs @@ -0,0 +1,78 @@ +using CliWrap; +using CliWrap.Buffered; +using Common; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Web.Administration; + +namespace UseSQLQueryData.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class IISController : ControllerBase + { + + [HttpPost()] + public async Task Recly() + { + var dt = DateTime.Now; + var span = new TimeSpan(0, 1, 0); + ReturnInfo r = new ReturnInfo(); + try + { + if (dt - Program.Dt > span) + { + + string Key = "IISRecycle"; + CSRedisCacheHelper.redis3.Set(Key,1); + //using (ServerManager serverManager = new ServerManager()) + //{ + // var pool = serverManager.ApplicationPools["DefaultAppPool"]; + // if (pool != null) + // { + // pool.Recycle(); + // r.isok = true; + // } + // else + // { + // r.isok = false; + // } + //} + + //Program.Dt = DateTime.Now; + //var cmd = await Cli.Wrap("1.cmd") + //.WithWorkingDirectory("D:\\BLW_Data\\cricsSQL") + //.ExecuteBufferedAsync(); + + + //var result = await Cli.Wrap(@"C:\Windows\System32\inetsrv\appcmd.exe") + // .WithArguments("recycle apppool /apppool.name:DefaultAppPool") + // .ExecuteBufferedAsync(); + + //if (result.ExitCode == 0) + //{ + // Console.WriteLine("应用程序池回收成功!"); + // Console.WriteLine(result.StandardOutput); + //} + //else + //{ + // Console.WriteLine($"回收失败,错误代码: {result.ExitCode}"); + // Console.WriteLine(result.StandardError); + //} + r.isok = true; + } + else + { + r.isok = false; + r.message = "1分钟之间只能回收一次"; + } + } + catch (Exception ex) + { + r.isok = false; + r.message = ex.Message; + } + return r; + } + } +} diff --git a/UseSQLQueryData/Controllers/MonitorController.cs b/UseSQLQueryData/Controllers/MonitorController.cs new file mode 100644 index 0000000..8f9dd87 --- /dev/null +++ b/UseSQLQueryData/Controllers/MonitorController.cs @@ -0,0 +1,91 @@ +using Common; +using CommonEntity; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using NLog; + +namespace UseSQLQueryData.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class MonitorController : ControllerBase + { + public static Logger logger = LogManager.GetCurrentClassLogger(); + [HttpPost()] + public ReturnInfo SetMonitor([FromBody] MonitorData lll) + { + ReturnInfo r = new ReturnInfo(); + try + { + lll.DataList.RemoveAll(x => string.IsNullOrEmpty(x.IPAddress) || x.Port <= 0); + var osa = lll.DataList.Select(x => { x.AddDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); return x; }).ToList(); + if (lll.Handler.Equals("add")) + { + var QQQ = CSRedisCacheHelper.Get>("MonitorEndPointList"); + + foreach (var item in osa) + { + bool bbb= QQQ.Any(A=>A.IPAddress.Equals(item.IPAddress)&&A.Port==item.Port); + if (bbb==false) + { + QQQ.Add(item); + } + } + CSRedisCacheHelper.Forever>("MonitorEndPointList",QQQ); + } + else if (lll.Handler.Equals("remove")) + { + var QQQ = CSRedisCacheHelper.Get>("MonitorEndPointList"); + foreach (var item in lll.DataList) + { + QQQ.RemoveAll(A => A.IPAddress.Equals(item.IPAddress) && A.Port == item.Port); + } + + CSRedisCacheHelper.Forever>("MonitorEndPointList", QQQ); + } + + r.isok = true; + r.response = "sucess"; + } + catch (Exception ex) + { + logger.Error(ex.Message); + logger.Error(ex.StackTrace); + r.isok = false; + r.response = ex.Message; + } + return r; + } + + [HttpPost()] + public ReturnInfo GetMonitorData() + { + ReturnInfo r = new ReturnInfo(); + try + { + var QQQ = CSRedisCacheHelper.Get>("MonitorEndPointList"); + r.isok = true; + r.response = QQQ; + } + catch (Exception ex) + { + logger.Error(ex.Message); + logger.Error(ex.StackTrace); + r.isok = false; + r.message = ex.Message; + } + return r; + } + } + public class MonitorData + { + public string? Handler { get; set; } + public List DataList { get; set; } + } + public class MonitorEndPoint + { + public string? IPAddress { get; set; } + public int? Port { get; set; } = 0; + public string? AddDateTime { get; set; } + } +} diff --git a/UseSQLQueryData/Controllers/ValuesController.cs b/UseSQLQueryData/Controllers/ValuesController.cs new file mode 100644 index 0000000..09494a6 --- /dev/null +++ b/UseSQLQueryData/Controllers/ValuesController.cs @@ -0,0 +1,364 @@ +using System.Data; +using CliWrap; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.OutputCaching; +using Microsoft.Data.SqlClient; +using NLog; +using RestSharp; +using static System.Runtime.InteropServices.JavaScript.JSType; + +namespace UseSQLQueryData.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class ValuesController : ControllerBase + { + public static string SqlConnectionString = "server=WIN-061EVIHKD86\\BLW;database=CRICS;uid=sa;pwd=pass@123$%^;TrustServerCertificate=True;"; + //public static string SqlConnectionString = "Data Source=DESKTOP-DUNS5K7;Initial Catalog=CRICS;User ID=sa;Password=123456;Trust Server Certificate=True"; + public static Logger logger = LogManager.GetCurrentClassLogger(); + [HttpGet()] + [OutputCache()] + public async Task GetRoomCount() + { + ReturnInfo returnInfo = new ReturnInfo(); + //return returnInfo; + try + { + using SqlConnection con = new SqlConnection(SqlConnectionString); + con.Open(); + using SqlCommand sqlCommand = con.CreateCommand(); + + string sql = @"select A.HotelID,B.Code,Count(A.HotelID) as TotalCount from tb_Hosts A + left join tb_Sys_Hotels B + on A.HotelID=B.ID + where A.IsDeleted=0 and B.IsDeleted=0 + group by HotelID,B.Code + ORDER BY HotelID;"; + sqlCommand.CommandText = sql; + //SqlParameter ps1 = new SqlParameter("@HotelID", hotelid); + //sqlCommand.Parameters.Add(ps1); + SqlDataAdapter adapter = new SqlDataAdapter(sqlCommand); + DataSet dataSet = new DataSet(); + adapter.Fill(dataSet); + + DataTable dt = dataSet.Tables[0]; + List chaList = new List(); + if (dt != null && dt.Rows.Count > 0) + { + foreach (DataRow item in dt.Rows) + { + var id = item["HotelID"].ToString(); + var totalcount = item["TotalCount"].ToString(); + var code = item["Code"].ToString(); + ChaXun cha = new ChaXun(); + cha.HotelID = id; + cha.HotelCode = code; + cha.TotalCount = totalcount; + chaList.Add(cha); + } + } + returnInfo.isok = true; + returnInfo.response = chaList; + } + catch (Exception ex) + { + returnInfo.isok = false; + returnInfo.message = ex.Message; + } + return returnInfo; + } + + /// + /// 生成主机标识号 + /// + /// + /// + [HttpPost()] + public async Task GenericHOSTNUMBER([FromForm] string HotelID, [FromForm] string HotelCode) + { + //2147 --099008 + ReturnInfo r = new ReturnInfo(); + try + { + logger.Error("HotelID:" + HotelID + " HotelCode:" + HotelCode); + ushort a = ushort.Parse(HotelCode); + byte[] bbf = BitConverter.GetBytes(a); + byte b1 = bbf[0]; + byte b2 = bbf[1]; + string nn1 = b1.ToString("000"); + string nn2 = b2.ToString("000"); + + string nn3 = nn1 + nn2; + + using SqlConnection con = new SqlConnection("server=WIN-061EVIHKD86\\BLW;database=CRICS;uid=sa;pwd=pass@123$%^;TrustServerCertificate=True;"); + con.Open(); + SqlTransaction tran = con.BeginTransaction(); + using SqlCommand sqlCommand = con.CreateCommand(); + sqlCommand.Transaction = tran; + + string sql = string.Format("select ID,MAC from tb_Hosts where HotelID={0} and IsDeleted=0 and MAC is not NULL and MAC!='';", HotelID); + sqlCommand.CommandText = sql; + SqlDataAdapter adapter = new SqlDataAdapter(sqlCommand); + DataSet dataSet = new DataSet(); + adapter.Fill(dataSet); + + DataTable dt = dataSet.Tables[0]; + if (dt != null && dt.Rows.Count > 0) + { + foreach (DataRow item in dt.Rows) + { + var id = item["ID"].ToString(); + var mymac = item["MAC"].ToString(); + if (!string.IsNullOrEmpty(mymac)) + { + + string[] NNN = mymac.Split('-'); + string n1 = NNN[4]; + string n2 = NNN[5]; + byte bbn1 = Convert.ToByte(n1, 16); + byte bbn2 = Convert.ToByte(n2, 16); + short MAC1 = Convert.ToInt16(bbn1); + short MAC2 = Convert.ToInt16(bbn2); + + string HOSTNUMBER = nn3 + MAC1.ToString("000") + MAC2.ToString("000"); + + string sql111 = string.Format(@"update tb_Hosts set HostNumber='{0}' where ID={1} and (HostNumber is NULL or HostNumber='');", HOSTNUMBER, id); + sqlCommand.CommandText = sql111; + await sqlCommand.ExecuteNonQueryAsync(); + } + + } + } + tran.Commit(); + r.isok = true; + r.response = "success"; + } + catch (Exception ex) + { + logger.Error("出错了" + ex.Message); + r.isok = false; + r.message = ex.Message; + } + return r; + } + + + + /// + /// + /// + /// + /// + [HttpPost()] + public async Task SendGetRCUInfoData(string HotelID) + { + ReturnInfo r = new ReturnInfo(); + try + { + + } + catch (Exception) + { + + throw; + } + return r; + } + + [HttpPost()] + public async Task HttpRecv() + { + + using var reader = new StreamReader(Request.Body); + var body = await reader.ReadToEndAsync(); + return body; + } + + + #region TFTP + + public static string BaseUrl = "https://www.boonlive-rcu.com/"; + + [HttpPost()] + public async Task GetTFTPInfo() + { + ReturnInfo r = new ReturnInfo(); + try + { + + using SqlConnection con = new SqlConnection(SqlConnectionString); + await con.OpenAsync(); + using SqlCommand sqlCommand = con.CreateCommand(); + + string sql = @"select A.*,B.HostNumber,B.MAC from TFTP_set A left join tb_Hosts B on A.HostID=B.ID;"; + sqlCommand.CommandText = sql; + SqlDataAdapter adapter = new SqlDataAdapter(sqlCommand); + DataSet dataSet = new DataSet(); + adapter.Fill(dataSet); + + DataTable dt = dataSet.Tables[0]; + List chaList = new List(); + if (dt != null && dt.Rows.Count > 0) + { + foreach (DataRow item in dt.Rows) + { + var id = item["ID"].ToString(); + var HotelCode = item["HotelCode"].ToString(); + var HotelID = item["HotelID"].ToString(); + var RoomNumber = item["RoomNumber"].ToString(); + var HostID = item["HostID"].ToString(); + var HostNumber = item["HostNumber"].ToString(); + var MAC = item["MAC"].ToString(); + var TargetPort = item["TargetPort"].ToString(); + var TargetDomain = item["TargetDomain"].ToString(); + var LT = item["LastTime"].ToString(); + var IT = item["IsTrigger"].ToString(); + var CT = item["CreateTime"].ToString(); + TFTPSet cha = new TFTPSet(); + cha.hotelcode = HotelCode; + cha.hotelid = HotelID; + cha.hostnumber = HostNumber; + cha.roomnumber = RoomNumber; + cha.mac = MAC; + cha.hostid = HostID; + cha.domain = TargetDomain; + cha.port = TargetPort; + cha.lasttime = LT; + cha.isenable = IT; + cha.createtime = CT; + chaList.Add(cha); + } + } + + var U = chaList.GroupBy(A => new { A.hotelid, A.hotelcode }); + List tl = new List(); + foreach (var item in U) + { + TFTP t = new TFTP(); + t.hotelcode = item.Key.hotelcode; + t.hotelid = item.Key.hotelid; + t.TFTPRoomList = item.ToList(); + tl.Add(t); + } + + r.isok = true; + r.response = tl; + } + catch (Exception) + { + + throw; + } + return r; + } + + /// + /// + /// + /// [{"hotelcode":"","hostnumber":"","mac":""}] + /// + [HttpPost()] + public async Task TFTPReadSet([FromBody] List> listdata) + { + + ReturnInfo r = new ReturnInfo(); + try + { + var options = new RestClientOptions(BaseUrl); + var client = new RestClient(options); + + var request = new RestRequest("api/TFTPReadSet"); + request.AddJsonBody(listdata); + RestResponse response = await client.PostAsync(request); + string? str1 = response.Content; + r.isok = true; + r.response = str1; + } + catch (Exception ex) + { + r.isok = false; + r.response = ex.Message; + } + return r; + } + + + [HttpPost()] + public async Task TFTPSet_Execute([FromBody] FTP_JSON body) + { + ReturnInfo r = new ReturnInfo(); + try + { + var options = new RestClientOptions(BaseUrl); + var client = new RestClient(options); + var request = new RestRequest("api/TFTPSet_Execute"); + request.AddJsonBody(body); + RestResponse response = await client.PostAsync(request); + string? str1 = response.Content; + r.isok = true; + r.response = str1; + } + catch (Exception ex) + { + r.isok = false; + r.response = ex.Message; + } + return r; + } + #endregion + + + } + public class TFTP + { + public string hotelcode { get; set; } + public string hotelid { get; set; } + public List TFTPRoomList { get; set; } + + } + public class TFTPSet + { + public string hotelcode { get; set; } + public string hotelid { get; set; } + public string hostid { get; set; } + public string roomnumber { get; set; } + public string hostnumber { get; set; } + public string mac { get; set; } + public string port { get; set; } + public string domain { get; set; } + /// + /// 上传 几个小时的日志 + /// + public string lasttime { get; set; } + public string isenable { get; set; } + public string createtime { get; set; } + } + + public class host_data + { + public string hostnumber { get; set; } + public string mac { get; set; } + } + public class FTP_JSON + { + public List host_data { get; set; } + public bool isenable { get; set; } + public string domain { get; set; } + public UInt16 port { get; set; } + public UInt16 lasttime { get; set; } + } + public class ChaXun + { + public string HotelID { get; set; } + public string HotelCode { get; set; } + public string TotalCount { get; set; } + } + public class ReturnInfo + { + public bool isok { set; get; } // 是否成功,true成功 + public string message { set; get; } // 传递接口信息,or报错信息 + public int status { set; get; } // 服务器报错信息,正确为200,错误404/500等 + public object response { set; get; } // 获取到的信息本体,若报错则为null + } +} diff --git a/UseSQLQueryData/Controllers/WeatherForecastController.cs b/UseSQLQueryData/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..a437a0d --- /dev/null +++ b/UseSQLQueryData/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace UseSQLQueryData.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} diff --git a/UseSQLQueryData/Program.cs b/UseSQLQueryData/Program.cs new file mode 100644 index 0000000..5c23d7c --- /dev/null +++ b/UseSQLQueryData/Program.cs @@ -0,0 +1,48 @@ +using DAL.New_Models; +using Microsoft.EntityFrameworkCore; + +namespace UseSQLQueryData +{ + public class Program + { + public static DateTime Dt = DateTime.Now; + public static void Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + + // Add services to the container. + + Dt =new DateTime(1970,1,1,0,0,0); + builder.Services.AddDbContext(options => + { + options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")); + }); + builder.Services.AddControllers(); + + builder.Services.AddMemoryCache(); + builder.Services.AddCors(options => + { + options.AddPolicy(name: "KuaYu", + policy => + { + policy + .AllowAnyOrigin() + .AllowAnyHeader() + .AllowAnyMethod(); + }); + }); + builder.Services.AddOutputCache(); + var app = builder.Build(); + + // Configure the HTTP request pipeline. + + app.UseCors("KuaYu"); + app.UseAuthorization(); + + + app.MapControllers(); + + app.Run(); + } + } +} diff --git a/UseSQLQueryData/Properties/PublishProfiles/FolderProfile.pubxml b/UseSQLQueryData/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..f452f8e --- /dev/null +++ b/UseSQLQueryData/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,22 @@ + + + + + false + false + true + Release + Any CPU + FileSystem + bin\Release\net8.0\publish\ + FileSystem + <_TargetId>Folder + + net8.0 + win-x64 + 10f5f2cb-a414-43db-a99a-68081f2800fc + true + + \ No newline at end of file diff --git a/UseSQLQueryData/Properties/PublishProfiles/FolderProfile.pubxml.user b/UseSQLQueryData/Properties/PublishProfiles/FolderProfile.pubxml.user new file mode 100644 index 0000000..1add2fb --- /dev/null +++ b/UseSQLQueryData/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -0,0 +1,11 @@ + + + + + <_PublishTargetUrl>E:\tian\BLS\BLWLogServer\UseSQLQueryData\bin\Release\net8.0\publish\ + True|2025-11-07T05:33:31.0471634Z||;True|2025-11-07T13:31:20.5682483+08:00||;True|2025-11-07T13:22:03.2538784+08:00||;True|2025-11-07T13:21:05.5293446+08:00||;True|2025-11-07T11:53:38.2357672+08:00||;True|2025-11-07T11:20:07.6912037+08:00||;True|2025-11-07T10:56:32.1932199+08:00||;True|2025-11-04T16:21:24.6016597+08:00||;True|2025-11-04T16:08:01.8306281+08:00||;True|2025-11-04T14:53:10.2683542+08:00||;True|2025-11-04T09:01:06.9087853+08:00||;True|2025-09-22T10:39:12.0773121+08:00||;True|2025-09-02T10:55:14.4248175+08:00||;True|2025-09-02T10:51:03.2536348+08:00||;True|2025-09-02T10:45:14.7601363+08:00||;True|2025-09-02T10:02:13.3617335+08:00||;True|2025-09-02T09:53:06.2207119+08:00||;True|2025-09-02T09:46:46.8635672+08:00||;False|2025-09-02T09:46:12.6849116+08:00||;True|2025-09-02T09:42:10.1092326+08:00||;True|2025-09-02T09:41:32.2469206+08:00||;True|2025-09-02T09:33:49.6721005+08:00||;True|2025-09-02T09:26:54.2061225+08:00||;True|2025-09-02T09:20:53.2529651+08:00||;True|2025-09-02T09:08:54.8123555+08:00||;True|2025-09-02T08:56:42.6561083+08:00||;True|2025-08-30T09:02:40.4888590+08:00||;True|2025-08-27T13:55:28.5898320+08:00||;True|2025-08-27T11:45:16.5325354+08:00||;True|2025-08-27T11:45:09.9546456+08:00||;True|2025-08-27T11:41:14.2662113+08:00||;True|2025-08-27T11:40:50.0169860+08:00||;True|2025-08-26T16:46:44.1731402+08:00||;True|2025-08-26T15:12:48.0529751+08:00||;True|2025-08-26T15:08:56.6003382+08:00||;True|2025-08-26T15:03:36.2932504+08:00||;True|2025-08-26T14:38:49.7608591+08:00||;True|2025-08-26T14:35:54.6541443+08:00||;True|2025-08-26T14:32:43.0146924+08:00||;True|2025-08-26T14:28:09.5325849+08:00||;True|2025-08-26T14:17:45.1671612+08:00||;True|2025-08-26T14:09:23.7912496+08:00||;True|2025-08-26T14:06:17.3251591+08:00||;True|2025-08-26T13:59:36.1310592+08:00||;True|2025-08-26T13:51:08.0473014+08:00||;True|2025-08-26T13:47:55.0643049+08:00||;True|2025-08-26T13:47:37.6858888+08:00||;True|2025-08-26T13:36:06.7868682+08:00||;True|2025-08-26T11:34:32.1855844+08:00||;True|2025-08-26T10:40:47.7552748+08:00||;True|2025-08-26T10:39:02.0026958+08:00||;True|2025-08-26T10:37:33.1782340+08:00||;True|2025-08-26T10:32:18.1084637+08:00||;True|2025-08-26T10:26:52.1716197+08:00||;True|2025-08-26T10:25:57.7810952+08:00||;True|2025-08-26T09:50:19.7164627+08:00||;True|2025-08-26T09:48:02.2640537+08:00||;True|2025-08-26T09:43:19.1545028+08:00||;True|2025-08-26T09:29:41.9360936+08:00||;True|2025-08-22T10:50:57.1412310+08:00||;True|2025-08-22T10:50:44.6477231+08:00||;True|2025-08-22T10:34:01.4521338+08:00||;True|2025-08-22T10:27:24.7964715+08:00||;True|2025-08-22T09:50:46.1928064+08:00||;True|2025-08-21T15:53:35.3929761+08:00||;True|2025-08-21T14:01:43.3138433+08:00||;True|2025-08-13T10:19:46.7006037+08:00||;True|2025-08-07T15:07:37.6383093+08:00||;True|2025-08-07T15:06:54.7720609+08:00||;True|2025-08-07T15:05:26.4943382+08:00||;True|2025-08-07T14:55:04.3839590+08:00||;True|2025-08-07T14:52:33.1834214+08:00||;True|2025-07-30T15:46:31.1561876+08:00||;True|2025-07-30T15:43:39.1118948+08:00||;True|2025-07-30T15:39:31.8063859+08:00||;True|2025-07-30T15:37:14.3864707+08:00||;True|2025-07-30T15:20:55.9890753+08:00||;True|2025-07-30T15:18:50.3835509+08:00||;True|2025-07-30T15:18:37.7136553+08:00||;True|2025-07-30T15:14:32.9036975+08:00||; + + + \ No newline at end of file diff --git a/UseSQLQueryData/Properties/launchSettings.json b/UseSQLQueryData/Properties/launchSettings.json new file mode 100644 index 0000000..2c592ea --- /dev/null +++ b/UseSQLQueryData/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:49723", + "sslPort": 0 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "weatherforecast", + "applicationUrl": "http://localhost:5108", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "weatherforecast", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/UseSQLQueryData/UseSQLQueryData.csproj b/UseSQLQueryData/UseSQLQueryData.csproj new file mode 100644 index 0000000..05f0679 --- /dev/null +++ b/UseSQLQueryData/UseSQLQueryData.csproj @@ -0,0 +1,25 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + + + + diff --git a/UseSQLQueryData/UseSQLQueryData.csproj.user b/UseSQLQueryData/UseSQLQueryData.csproj.user new file mode 100644 index 0000000..bb95582 --- /dev/null +++ b/UseSQLQueryData/UseSQLQueryData.csproj.user @@ -0,0 +1,8 @@ + + + + ApiControllerEmptyScaffolder + root/Common/Api + E:\tian\BLS\BLWLogServer\UseSQLQueryData\Properties\PublishProfiles\FolderProfile.pubxml + + \ No newline at end of file diff --git a/UseSQLQueryData/UseSQLQueryData.http b/UseSQLQueryData/UseSQLQueryData.http new file mode 100644 index 0000000..f095885 --- /dev/null +++ b/UseSQLQueryData/UseSQLQueryData.http @@ -0,0 +1,6 @@ +@UseSQLQueryData_HostAddress = http://localhost:5108 + +GET {{UseSQLQueryData_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/UseSQLQueryData/WeatherForecast.cs b/UseSQLQueryData/WeatherForecast.cs new file mode 100644 index 0000000..98fc594 --- /dev/null +++ b/UseSQLQueryData/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace UseSQLQueryData +{ + public class WeatherForecast + { + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} diff --git a/UseSQLQueryData/appsettings.Development.json b/UseSQLQueryData/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/UseSQLQueryData/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/UseSQLQueryData/appsettings.json b/UseSQLQueryData/appsettings.json new file mode 100644 index 0000000..b48268f --- /dev/null +++ b/UseSQLQueryData/appsettings.json @@ -0,0 +1,15 @@ +{ + + "ConnectionStrings": { + "DefaultConnection": "Data Source=DESKTOP-DUNS5K7;Initial Catalog=RICS;User ID=sa;Password=123456;Trust Server Certificate=True" + }, + "HiWeiAppId": "wijsv8hf5izejkny", + "HiWeiAppSecret": "6c1014dab24c41369068d12e4f7e145c", + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/UseSQLQueryData/nlog.config b/UseSQLQueryData/nlog.config new file mode 100644 index 0000000..3a1832e --- /dev/null +++ b/UseSQLQueryData/nlog.config @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/duoge/Person.cs b/duoge/Person.cs new file mode 100644 index 0000000..94a27bf --- /dev/null +++ b/duoge/Person.cs @@ -0,0 +1,318 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: person.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tutorial { + + /// Holder for reflection information generated from person.proto + public static partial class PersonReflection { + + #region Descriptor + /// File descriptor for person.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static PersonReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CgxwZXJzb24ucHJvdG8SCHR1dG9yaWFsIjEKBlBlcnNvbhIMCgRuYW1lGAEg", + "ASgJEgoKAmlkGAIgASgFEg0KBWVtYWlsGAMgASgJYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tutorial.Person), global::Tutorial.Person.Parser, new[]{ "Name", "Id", "Email" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// 定义一个Person消息类型 + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class Person : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Person()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tutorial.PersonReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Person() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Person(Person other) : this() { + name_ = other.name_; + id_ = other.id_; + email_ = other.email_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Person Clone() { + return new Person(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 2; + private int id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "email" field. + public const int EmailFieldNumber = 3; + private string email_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Email { + get { return email_; } + set { + email_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Person); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Person other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (Id != other.Id) return false; + if (Email != other.Email) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Id != 0) hash ^= Id.GetHashCode(); + if (Email.Length != 0) hash ^= Email.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Id != 0) { + output.WriteRawTag(16); + output.WriteInt32(Id); + } + if (Email.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Email); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Id != 0) { + output.WriteRawTag(16); + output.WriteInt32(Id); + } + if (Email.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Email); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Id != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); + } + if (Email.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Email); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Person other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Id != 0) { + Id = other.Id; + } + if (other.Email.Length != 0) { + Email = other.Email; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 16: { + Id = input.ReadInt32(); + break; + } + case 26: { + Email = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 16: { + Id = input.ReadInt32(); + break; + } + case 26: { + Email = input.ReadString(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/duoge/Person1.cs b/duoge/Person1.cs new file mode 100644 index 0000000..b81e9e5 --- /dev/null +++ b/duoge/Person1.cs @@ -0,0 +1,9 @@ +namespace duoge +{ + //internal class Person + //{ + // public string? Name { get; internal set; } + // public int Id { get; internal set; } + // public string? Email { get; internal set; } + //} +} \ No newline at end of file diff --git a/duoge/Program.cs b/duoge/Program.cs new file mode 100644 index 0000000..dc98e87 --- /dev/null +++ b/duoge/Program.cs @@ -0,0 +1,135 @@ +using System.Text; +using Confluent.Kafka; +using Google.Protobuf; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Tutorial; + +namespace duoge +{ + internal class Program + { + static void Main(string[] args) + { + + string json = @"{ 'name': 'John Doe', 'id': 123, 'email': 'john@example.com' }"; + JObject jsonObject = JObject.Parse(json); + Person person = new Person(); + person.Name = (string)jsonObject["name"]; + person.Id = (int)jsonObject["id"]; + person.Email = (string)jsonObject["email"]; + Console.WriteLine("Name: " + person.Name); // 输出转换后的ProtoBuf对象信息 + byte[] bbb1 = Encoding.UTF8.GetBytes(json); + + byte[] bbb = person.ToByteArray(); + + Person PPP = Person.Parser.ParseFrom(bbb); + + + // 方法1:使用静态Parser(推荐) + Person restoredPerson1 = Person.Parser.ParseFrom(bbb); + + // 方法2:创建新的Parser实例 + var parser = new MessageParser(() => new Person()); + Person restoredPerson2 = parser.ParseFrom(bbb); + + // 方法3:使用扩展方法 + Person restoredPerson3 = Person.Parser.ParseFrom(bbb.AsMemory().ToArray()); + Console.WriteLine("Hello, World!"); + } + + static void MMM() + { + + string[] _topics = ["", ""]; + List> _consumers = new List>(); + // 为每个主题创建一个消费者 + foreach (var topic in _topics) + { + var consumerConfig = new ConsumerConfig + { + BootstrapServers = "localhost:9092", + GroupId = $"consumer-group-{topic}", + AutoOffsetReset = AutoOffsetReset.Earliest, + EnableAutoCommit = false + }; + + var consumer = new ConsumerBuilder(consumerConfig).Build(); + consumer.Subscribe(topic); + _consumers.Add(consumer); + + // 为每个消费者启动一个独立的任务 + Task.Run(() => ConsumeMessages(consumer, topic)); + } + } + + + static private async Task ConsumeMessages(IConsumer consumer, string topic) + { + try + { + var consumeResult = consumer.Consume(); + + if (consumeResult != null) + { + Console.WriteLine($"收到消息 - 主题: {topic}, 键: {consumeResult.Message.Key}, 值: {consumeResult.Message.Value}"); + + // 手动提交偏移量 + consumer.Commit(consumeResult); + } + } + catch (ConsumeException ex) + { + } + catch (OperationCanceledException) + { + } + } + + //private async Task ProcessMessage(string topic, string key, string value) + //{ + // // 根据不同的主题执行不同的处理逻辑 + // switch (topic) + // { + // case "topic-1": + // await ProcessTopic1Message(key, value); + // break; + // case "topic-2": + // await ProcessTopic2Message(key, value); + // break; + // // ... 其他主题的处理逻辑 + // default: + // _logger.LogInformation($"处理默认主题消息: {topic}, Key: {key}, Value: {value}"); + // break; + // } + //} + + //private async Task ProcessTopic1Message(string key, string value) + //{ + // // 主题1的具体处理逻辑 + // await Task.Delay(100); // 模拟处理耗时 + // _logger.LogInformation($"处理主题1消息: Key={key}, Value={value}"); + //} + + //private async Task ProcessTopic2Message(string key, string value) + //{ + // // 主题2的具体处理逻辑 + // await Task.Delay(100); // 模拟处理耗时 + // _logger.LogInformation($"处理主题2消息: Key={key}, Value={value}"); + //} + + //public Task StopAsync(CancellationToken cancellationToken) + //{ + // _logger.LogInformation("停止Kafka消费者服务..."); + // _cancellationTokenSource.Cancel(); + + // foreach (var consumer in _consumers) + // { + // consumer.Close(); + // consumer.Dispose(); + // } + + // return Task.CompletedTask; + //} + } +} diff --git a/duoge/duoge.csproj b/duoge/duoge.csproj new file mode 100644 index 0000000..8710577 --- /dev/null +++ b/duoge/duoge.csproj @@ -0,0 +1,16 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + diff --git a/duoge/person.proto b/duoge/person.proto new file mode 100644 index 0000000..3464151 --- /dev/null +++ b/duoge/person.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package tutorial; + +// 定义一个Person消息类型 +message Person { + string name = 1; + int32 id = 2; + string email = 3; +} \ No newline at end of file diff --git a/mypwsh/Program.cs b/mypwsh/Program.cs new file mode 100644 index 0000000..a4b1015 --- /dev/null +++ b/mypwsh/Program.cs @@ -0,0 +1,24 @@ +using System.Collections.ObjectModel; +using System.Management.Automation; +using System.Management.Automation.Runspaces; +namespace mypwsh +{ + internal class Program + { + static void Main(string[] args) + { + using (var ps = PowerShell.Create()) + { + // 避免使用 AddScript,改用 AddCommand + ps.AddCommand("Get-Service"); + + var results = ps.Invoke(); + foreach (var result in results) + { + var service = result.BaseObject; + } + } + Console.WriteLine("Hello, World!"); + } + } +} diff --git a/mypwsh/mypwsh.csproj b/mypwsh/mypwsh.csproj new file mode 100644 index 0000000..94d3d43 --- /dev/null +++ b/mypwsh/mypwsh.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0-windows + enable + enable + + + + + + + + diff --git a/回收/Program.cs b/回收/Program.cs new file mode 100644 index 0000000..f2f5a78 --- /dev/null +++ b/回收/Program.cs @@ -0,0 +1,43 @@ +using System.Timers; +using CliWrap; +using CliWrap.Buffered; +using Common; + +namespace 回收 +{ + internal class Program + { + public static System.Timers.Timer timer; + async static Task Main(string[] args) + { + timer = new System.Timers.Timer(); + timer.Elapsed += Timer_Elapsed; + timer.Interval = 20000; + timer.Start(); + Console.ReadLine(); + } + + static void Timer_Elapsed(object? sender, ElapsedEventArgs e) + { + try + { + Console.WriteLine("go..."); + string Key = "IISRecycle"; + int isnew = CSRedisCacheHelper.redis3.Get(Key); + if (isnew == 1) + { + Console.WriteLine("回收了"); + var cmd = Cli.Wrap("1.cmd") + .WithWorkingDirectory("D:\\BLW_Data\\cricsSQL") + .ExecuteBufferedAsync(); + CSRedisCacheHelper.redis3.Set(Key, 0); + } + + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + } +} diff --git a/回收/Properties/PublishProfiles/FolderProfile.pubxml b/回收/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..49eb151 --- /dev/null +++ b/回收/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,18 @@ + + + + + Release + Any CPU + bin\Release\net8.0\publish\win-x64\ + FileSystem + <_TargetId>Folder + net8.0 + win-x64 + false + true + false + + \ No newline at end of file diff --git a/回收/Properties/PublishProfiles/FolderProfile.pubxml.user b/回收/Properties/PublishProfiles/FolderProfile.pubxml.user new file mode 100644 index 0000000..5ae691b --- /dev/null +++ b/回收/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -0,0 +1,10 @@ + + + + + True|2025-08-26T07:21:29.5034370Z||;True|2025-08-26T15:16:46.4013959+08:00||;True|2025-08-26T15:07:26.0874195+08:00||;True|2025-08-26T15:06:56.8708063+08:00||;True|2025-08-26T15:06:37.5140254+08:00||;True|2025-08-26T15:06:26.3756042+08:00||;True|2025-08-26T14:48:29.3506426+08:00||; + + + \ No newline at end of file diff --git a/回收/回收.csproj b/回收/回收.csproj new file mode 100644 index 0000000..f30f17b --- /dev/null +++ b/回收/回收.csproj @@ -0,0 +1,18 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + + + diff --git a/回收/回收.csproj.user b/回收/回收.csproj.user new file mode 100644 index 0000000..0efe250 --- /dev/null +++ b/回收/回收.csproj.user @@ -0,0 +1,6 @@ + + + + <_LastSelectedProfileId>E:\tian\BLS\BLWLogServer\回收\Properties\PublishProfiles\FolderProfile.pubxml + + \ No newline at end of file diff --git a/心跳维持/Program.cs b/心跳维持/Program.cs new file mode 100644 index 0000000..b41e19f --- /dev/null +++ b/心跳维持/Program.cs @@ -0,0 +1,38 @@ +using System; +using System.Timers; +using RestSharp; +using static System.Runtime.InteropServices.JavaScript.JSType; + +namespace 心跳维持 +{ + internal class Program + { + public static System.Timers.Timer timer; + static void Main(string[] args) + { + timer = new System.Timers.Timer(); + timer.Interval = 20000; + timer.Elapsed += Timer_Elapsed; + timer.Start(); + Console.ReadLine(); + } + + private static void Timer_Elapsed(object? sender, ElapsedEventArgs e) + { + try + { + Console.WriteLine("心跳检测"); + var options = new RestClientOptions("http://localhost:19088/"); + var client = new RestClient(options); + var request = new RestRequest("api/values/HeartBeat"); + var response = client.Post(request); + string? str1 = response.Content; + Console.WriteLine(str1); + } + catch (Exception) + { + + } + } + } +} diff --git a/心跳维持/Properties/PublishProfiles/FolderProfile.pubxml b/心跳维持/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..6a5f76e --- /dev/null +++ b/心跳维持/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,18 @@ + + + + + Release + Any CPU + bin\publish\ + FileSystem + <_TargetId>Folder + net8.0 + win-x64 + false + true + false + + \ No newline at end of file diff --git a/心跳维持/Properties/PublishProfiles/FolderProfile.pubxml.user b/心跳维持/Properties/PublishProfiles/FolderProfile.pubxml.user new file mode 100644 index 0000000..7f7db6e --- /dev/null +++ b/心跳维持/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -0,0 +1,10 @@ + + + + + True|2025-07-25T07:34:31.4879290Z||;True|2025-07-25T15:19:59.2970683+08:00||; + + + \ No newline at end of file diff --git a/心跳维持/心跳维持.csproj b/心跳维持/心跳维持.csproj new file mode 100644 index 0000000..c5baf53 --- /dev/null +++ b/心跳维持/心跳维持.csproj @@ -0,0 +1,14 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + diff --git a/心跳维持/心跳维持.csproj.user b/心跳维持/心跳维持.csproj.user new file mode 100644 index 0000000..77aef66 --- /dev/null +++ b/心跳维持/心跳维持.csproj.user @@ -0,0 +1,6 @@ + + + + <_LastSelectedProfileId>E:\tian\BLS\BLWLogServer\心跳维持\Properties\PublishProfiles\FolderProfile.pubxml + + \ No newline at end of file diff --git a/消费/EnergyConsumption.cs b/消费/EnergyConsumption.cs new file mode 100644 index 0000000..6f64b66 --- /dev/null +++ b/消费/EnergyConsumption.cs @@ -0,0 +1,1332 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: EnergyConsumption.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace BLWData.Entity { + + /// Holder for reflection information generated from EnergyConsumption.proto + public static partial class EnergyConsumptionReflection { + + #region Descriptor + /// File descriptor for EnergyConsumption.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static EnergyConsumptionReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChdFbmVyZ3lDb25zdW1wdGlvbi5wcm90bxIOQkxXRGF0YS5FbnRpdHkivgEK", + "CkRldmljZURhdGESDgoGSG9zdElEGAEgASgDEhIKCkRldmljZVR5cGUYAiAB", + "KAkSDwoHQWRkcmVzcxgDIAEoCRIOCgZTdGF0dXMYBCABKAUSEgoKQnJpZ2h0", + "bmVzcxgFIAEoBRITCgtDdXJyZW50VGVtcBgGIAEoBRITCgtTZXR0aW5nVGVt", + "cBgHIAEoBRIQCghGYW5TcGVlZBgIIAEoBRIMCgRNb2RlGAkgASgFEg0KBVZh", + "bHZlGAogASgFIuICChFFbmVyZ3lDb25zdW1wdGlvbhIRCglIb3RlbENvZGUY", + "ASABKAMSEgoKSG9zdE51bWJlchgCIAEoCRILCgNNYWMYAyABKAkSEAoIRW5k", + "UG9pbnQYBCABKAkSDwoHVmVyc2lvbhgFIAEoCRISCgpJc1Rha2VDYXJkGAYg", + "ASgIEgkKAVYYByABKAESCQoBQRgIIAEoARIJCgFQGAkgASgBEhoKEkVuZXJn", + "eV9Db25zdW1wdGlvbhgKIAEoARIeChZTdW1fRW5lcmd5X0NvbnN1bXB0aW9u", + "GAsgASgBEhIKCkNyZWF0ZVRpbWUYDCABKAMSEgoKUm9vbU51bWJlchgNIAEo", + "CRIRCglDYXJib25WSVAYDiABKAUSFAoMSWRlbnRpdHlJbmZvGA8gASgFEjQK", + "EERldmljZVN0YXR1c0xpc3QYECADKAsyGi5CTFdEYXRhLkVudGl0eS5EZXZp", + "Y2VEYXRhYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::BLWData.Entity.DeviceData), global::BLWData.Entity.DeviceData.Parser, new[]{ "HostID", "DeviceType", "Address", "Status", "Brightness", "CurrentTemp", "SettingTemp", "FanSpeed", "Mode", "Valve" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::BLWData.Entity.EnergyConsumption), global::BLWData.Entity.EnergyConsumption.Parser, new[]{ "HotelCode", "HostNumber", "Mac", "EndPoint", "Version", "IsTakeCard", "V", "A", "P", "EnergyConsumption_", "SumEnergyConsumption", "CreateTime", "RoomNumber", "CarbonVIP", "IdentityInfo", "DeviceStatusList" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class DeviceData : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeviceData()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::BLWData.Entity.EnergyConsumptionReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceData() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceData(DeviceData other) : this() { + hostID_ = other.hostID_; + deviceType_ = other.deviceType_; + address_ = other.address_; + status_ = other.status_; + brightness_ = other.brightness_; + currentTemp_ = other.currentTemp_; + settingTemp_ = other.settingTemp_; + fanSpeed_ = other.fanSpeed_; + mode_ = other.mode_; + valve_ = other.valve_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceData Clone() { + return new DeviceData(this); + } + + /// Field number for the "HostID" field. + public const int HostIDFieldNumber = 1; + private long hostID_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long HostID { + get { return hostID_; } + set { + hostID_ = value; + } + } + + /// Field number for the "DeviceType" field. + public const int DeviceTypeFieldNumber = 2; + private string deviceType_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string DeviceType { + get { return deviceType_; } + set { + deviceType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Address" field. + public const int AddressFieldNumber = 3; + private string address_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Address { + get { return address_; } + set { + address_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Status" field. + public const int StatusFieldNumber = 4; + private int status_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Status { + get { return status_; } + set { + status_ = value; + } + } + + /// Field number for the "Brightness" field. + public const int BrightnessFieldNumber = 5; + private int brightness_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Brightness { + get { return brightness_; } + set { + brightness_ = value; + } + } + + /// Field number for the "CurrentTemp" field. + public const int CurrentTempFieldNumber = 6; + private int currentTemp_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CurrentTemp { + get { return currentTemp_; } + set { + currentTemp_ = value; + } + } + + /// Field number for the "SettingTemp" field. + public const int SettingTempFieldNumber = 7; + private int settingTemp_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int SettingTemp { + get { return settingTemp_; } + set { + settingTemp_ = value; + } + } + + /// Field number for the "FanSpeed" field. + public const int FanSpeedFieldNumber = 8; + private int fanSpeed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int FanSpeed { + get { return fanSpeed_; } + set { + fanSpeed_ = value; + } + } + + /// Field number for the "Mode" field. + public const int ModeFieldNumber = 9; + private int mode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Mode { + get { return mode_; } + set { + mode_ = value; + } + } + + /// Field number for the "Valve" field. + public const int ValveFieldNumber = 10; + private int valve_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Valve { + get { return valve_; } + set { + valve_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DeviceData); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DeviceData other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HostID != other.HostID) return false; + if (DeviceType != other.DeviceType) return false; + if (Address != other.Address) return false; + if (Status != other.Status) return false; + if (Brightness != other.Brightness) return false; + if (CurrentTemp != other.CurrentTemp) return false; + if (SettingTemp != other.SettingTemp) return false; + if (FanSpeed != other.FanSpeed) return false; + if (Mode != other.Mode) return false; + if (Valve != other.Valve) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HostID != 0L) hash ^= HostID.GetHashCode(); + if (DeviceType.Length != 0) hash ^= DeviceType.GetHashCode(); + if (Address.Length != 0) hash ^= Address.GetHashCode(); + if (Status != 0) hash ^= Status.GetHashCode(); + if (Brightness != 0) hash ^= Brightness.GetHashCode(); + if (CurrentTemp != 0) hash ^= CurrentTemp.GetHashCode(); + if (SettingTemp != 0) hash ^= SettingTemp.GetHashCode(); + if (FanSpeed != 0) hash ^= FanSpeed.GetHashCode(); + if (Mode != 0) hash ^= Mode.GetHashCode(); + if (Valve != 0) hash ^= Valve.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HostID != 0L) { + output.WriteRawTag(8); + output.WriteInt64(HostID); + } + if (DeviceType.Length != 0) { + output.WriteRawTag(18); + output.WriteString(DeviceType); + } + if (Address.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Address); + } + if (Status != 0) { + output.WriteRawTag(32); + output.WriteInt32(Status); + } + if (Brightness != 0) { + output.WriteRawTag(40); + output.WriteInt32(Brightness); + } + if (CurrentTemp != 0) { + output.WriteRawTag(48); + output.WriteInt32(CurrentTemp); + } + if (SettingTemp != 0) { + output.WriteRawTag(56); + output.WriteInt32(SettingTemp); + } + if (FanSpeed != 0) { + output.WriteRawTag(64); + output.WriteInt32(FanSpeed); + } + if (Mode != 0) { + output.WriteRawTag(72); + output.WriteInt32(Mode); + } + if (Valve != 0) { + output.WriteRawTag(80); + output.WriteInt32(Valve); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HostID != 0L) { + output.WriteRawTag(8); + output.WriteInt64(HostID); + } + if (DeviceType.Length != 0) { + output.WriteRawTag(18); + output.WriteString(DeviceType); + } + if (Address.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Address); + } + if (Status != 0) { + output.WriteRawTag(32); + output.WriteInt32(Status); + } + if (Brightness != 0) { + output.WriteRawTag(40); + output.WriteInt32(Brightness); + } + if (CurrentTemp != 0) { + output.WriteRawTag(48); + output.WriteInt32(CurrentTemp); + } + if (SettingTemp != 0) { + output.WriteRawTag(56); + output.WriteInt32(SettingTemp); + } + if (FanSpeed != 0) { + output.WriteRawTag(64); + output.WriteInt32(FanSpeed); + } + if (Mode != 0) { + output.WriteRawTag(72); + output.WriteInt32(Mode); + } + if (Valve != 0) { + output.WriteRawTag(80); + output.WriteInt32(Valve); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HostID != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(HostID); + } + if (DeviceType.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(DeviceType); + } + if (Address.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Address); + } + if (Status != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Status); + } + if (Brightness != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Brightness); + } + if (CurrentTemp != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(CurrentTemp); + } + if (SettingTemp != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(SettingTemp); + } + if (FanSpeed != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(FanSpeed); + } + if (Mode != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Mode); + } + if (Valve != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Valve); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DeviceData other) { + if (other == null) { + return; + } + if (other.HostID != 0L) { + HostID = other.HostID; + } + if (other.DeviceType.Length != 0) { + DeviceType = other.DeviceType; + } + if (other.Address.Length != 0) { + Address = other.Address; + } + if (other.Status != 0) { + Status = other.Status; + } + if (other.Brightness != 0) { + Brightness = other.Brightness; + } + if (other.CurrentTemp != 0) { + CurrentTemp = other.CurrentTemp; + } + if (other.SettingTemp != 0) { + SettingTemp = other.SettingTemp; + } + if (other.FanSpeed != 0) { + FanSpeed = other.FanSpeed; + } + if (other.Mode != 0) { + Mode = other.Mode; + } + if (other.Valve != 0) { + Valve = other.Valve; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + HostID = input.ReadInt64(); + break; + } + case 18: { + DeviceType = input.ReadString(); + break; + } + case 26: { + Address = input.ReadString(); + break; + } + case 32: { + Status = input.ReadInt32(); + break; + } + case 40: { + Brightness = input.ReadInt32(); + break; + } + case 48: { + CurrentTemp = input.ReadInt32(); + break; + } + case 56: { + SettingTemp = input.ReadInt32(); + break; + } + case 64: { + FanSpeed = input.ReadInt32(); + break; + } + case 72: { + Mode = input.ReadInt32(); + break; + } + case 80: { + Valve = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + HostID = input.ReadInt64(); + break; + } + case 18: { + DeviceType = input.ReadString(); + break; + } + case 26: { + Address = input.ReadString(); + break; + } + case 32: { + Status = input.ReadInt32(); + break; + } + case 40: { + Brightness = input.ReadInt32(); + break; + } + case 48: { + CurrentTemp = input.ReadInt32(); + break; + } + case 56: { + SettingTemp = input.ReadInt32(); + break; + } + case 64: { + FanSpeed = input.ReadInt32(); + break; + } + case 72: { + Mode = input.ReadInt32(); + break; + } + case 80: { + Valve = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + /// + /// 定义一个Person消息类型 + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class EnergyConsumption : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnergyConsumption()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::BLWData.Entity.EnergyConsumptionReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnergyConsumption() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnergyConsumption(EnergyConsumption other) : this() { + hotelCode_ = other.hotelCode_; + hostNumber_ = other.hostNumber_; + mac_ = other.mac_; + endPoint_ = other.endPoint_; + version_ = other.version_; + isTakeCard_ = other.isTakeCard_; + v_ = other.v_; + a_ = other.a_; + p_ = other.p_; + energyConsumption_ = other.energyConsumption_; + sumEnergyConsumption_ = other.sumEnergyConsumption_; + createTime_ = other.createTime_; + roomNumber_ = other.roomNumber_; + carbonVIP_ = other.carbonVIP_; + identityInfo_ = other.identityInfo_; + deviceStatusList_ = other.deviceStatusList_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnergyConsumption Clone() { + return new EnergyConsumption(this); + } + + /// Field number for the "HotelCode" field. + public const int HotelCodeFieldNumber = 1; + private long hotelCode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long HotelCode { + get { return hotelCode_; } + set { + hotelCode_ = value; + } + } + + /// Field number for the "HostNumber" field. + public const int HostNumberFieldNumber = 2; + private string hostNumber_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string HostNumber { + get { return hostNumber_; } + set { + hostNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Mac" field. + public const int MacFieldNumber = 3; + private string mac_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Mac { + get { return mac_; } + set { + mac_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "EndPoint" field. + public const int EndPointFieldNumber = 4; + private string endPoint_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string EndPoint { + get { return endPoint_; } + set { + endPoint_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Version" field. + public const int VersionFieldNumber = 5; + private string version_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Version { + get { return version_; } + set { + version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "IsTakeCard" field. + public const int IsTakeCardFieldNumber = 6; + private bool isTakeCard_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsTakeCard { + get { return isTakeCard_; } + set { + isTakeCard_ = value; + } + } + + /// Field number for the "V" field. + public const int VFieldNumber = 7; + private double v_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double V { + get { return v_; } + set { + v_ = value; + } + } + + /// Field number for the "A" field. + public const int AFieldNumber = 8; + private double a_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double A { + get { return a_; } + set { + a_ = value; + } + } + + /// Field number for the "P" field. + public const int PFieldNumber = 9; + private double p_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double P { + get { return p_; } + set { + p_ = value; + } + } + + /// Field number for the "Energy_Consumption" field. + public const int EnergyConsumption_FieldNumber = 10; + private double energyConsumption_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double EnergyConsumption_ { + get { return energyConsumption_; } + set { + energyConsumption_ = value; + } + } + + /// Field number for the "Sum_Energy_Consumption" field. + public const int SumEnergyConsumptionFieldNumber = 11; + private double sumEnergyConsumption_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double SumEnergyConsumption { + get { return sumEnergyConsumption_; } + set { + sumEnergyConsumption_ = value; + } + } + + /// Field number for the "CreateTime" field. + public const int CreateTimeFieldNumber = 12; + private long createTime_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long CreateTime { + get { return createTime_; } + set { + createTime_ = value; + } + } + + /// Field number for the "RoomNumber" field. + public const int RoomNumberFieldNumber = 13; + private string roomNumber_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string RoomNumber { + get { return roomNumber_; } + set { + roomNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "CarbonVIP" field. + public const int CarbonVIPFieldNumber = 14; + private int carbonVIP_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CarbonVIP { + get { return carbonVIP_; } + set { + carbonVIP_ = value; + } + } + + /// Field number for the "IdentityInfo" field. + public const int IdentityInfoFieldNumber = 15; + private int identityInfo_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int IdentityInfo { + get { return identityInfo_; } + set { + identityInfo_ = value; + } + } + + /// Field number for the "DeviceStatusList" field. + public const int DeviceStatusListFieldNumber = 16; + private static readonly pb::FieldCodec _repeated_deviceStatusList_codec + = pb::FieldCodec.ForMessage(130, global::BLWData.Entity.DeviceData.Parser); + private readonly pbc::RepeatedField deviceStatusList_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField DeviceStatusList { + get { return deviceStatusList_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as EnergyConsumption); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(EnergyConsumption other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (HotelCode != other.HotelCode) return false; + if (HostNumber != other.HostNumber) return false; + if (Mac != other.Mac) return false; + if (EndPoint != other.EndPoint) return false; + if (Version != other.Version) return false; + if (IsTakeCard != other.IsTakeCard) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(V, other.V)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(A, other.A)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(P, other.P)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(EnergyConsumption_, other.EnergyConsumption_)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(SumEnergyConsumption, other.SumEnergyConsumption)) return false; + if (CreateTime != other.CreateTime) return false; + if (RoomNumber != other.RoomNumber) return false; + if (CarbonVIP != other.CarbonVIP) return false; + if (IdentityInfo != other.IdentityInfo) return false; + if(!deviceStatusList_.Equals(other.deviceStatusList_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HotelCode != 0L) hash ^= HotelCode.GetHashCode(); + if (HostNumber.Length != 0) hash ^= HostNumber.GetHashCode(); + if (Mac.Length != 0) hash ^= Mac.GetHashCode(); + if (EndPoint.Length != 0) hash ^= EndPoint.GetHashCode(); + if (Version.Length != 0) hash ^= Version.GetHashCode(); + if (IsTakeCard != false) hash ^= IsTakeCard.GetHashCode(); + if (V != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(V); + if (A != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(A); + if (P != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(P); + if (EnergyConsumption_ != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(EnergyConsumption_); + if (SumEnergyConsumption != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(SumEnergyConsumption); + if (CreateTime != 0L) hash ^= CreateTime.GetHashCode(); + if (RoomNumber.Length != 0) hash ^= RoomNumber.GetHashCode(); + if (CarbonVIP != 0) hash ^= CarbonVIP.GetHashCode(); + if (IdentityInfo != 0) hash ^= IdentityInfo.GetHashCode(); + hash ^= deviceStatusList_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HotelCode != 0L) { + output.WriteRawTag(8); + output.WriteInt64(HotelCode); + } + if (HostNumber.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HostNumber); + } + if (Mac.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Mac); + } + if (EndPoint.Length != 0) { + output.WriteRawTag(34); + output.WriteString(EndPoint); + } + if (Version.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Version); + } + if (IsTakeCard != false) { + output.WriteRawTag(48); + output.WriteBool(IsTakeCard); + } + if (V != 0D) { + output.WriteRawTag(57); + output.WriteDouble(V); + } + if (A != 0D) { + output.WriteRawTag(65); + output.WriteDouble(A); + } + if (P != 0D) { + output.WriteRawTag(73); + output.WriteDouble(P); + } + if (EnergyConsumption_ != 0D) { + output.WriteRawTag(81); + output.WriteDouble(EnergyConsumption_); + } + if (SumEnergyConsumption != 0D) { + output.WriteRawTag(89); + output.WriteDouble(SumEnergyConsumption); + } + if (CreateTime != 0L) { + output.WriteRawTag(96); + output.WriteInt64(CreateTime); + } + if (RoomNumber.Length != 0) { + output.WriteRawTag(106); + output.WriteString(RoomNumber); + } + if (CarbonVIP != 0) { + output.WriteRawTag(112); + output.WriteInt32(CarbonVIP); + } + if (IdentityInfo != 0) { + output.WriteRawTag(120); + output.WriteInt32(IdentityInfo); + } + deviceStatusList_.WriteTo(output, _repeated_deviceStatusList_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HotelCode != 0L) { + output.WriteRawTag(8); + output.WriteInt64(HotelCode); + } + if (HostNumber.Length != 0) { + output.WriteRawTag(18); + output.WriteString(HostNumber); + } + if (Mac.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Mac); + } + if (EndPoint.Length != 0) { + output.WriteRawTag(34); + output.WriteString(EndPoint); + } + if (Version.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Version); + } + if (IsTakeCard != false) { + output.WriteRawTag(48); + output.WriteBool(IsTakeCard); + } + if (V != 0D) { + output.WriteRawTag(57); + output.WriteDouble(V); + } + if (A != 0D) { + output.WriteRawTag(65); + output.WriteDouble(A); + } + if (P != 0D) { + output.WriteRawTag(73); + output.WriteDouble(P); + } + if (EnergyConsumption_ != 0D) { + output.WriteRawTag(81); + output.WriteDouble(EnergyConsumption_); + } + if (SumEnergyConsumption != 0D) { + output.WriteRawTag(89); + output.WriteDouble(SumEnergyConsumption); + } + if (CreateTime != 0L) { + output.WriteRawTag(96); + output.WriteInt64(CreateTime); + } + if (RoomNumber.Length != 0) { + output.WriteRawTag(106); + output.WriteString(RoomNumber); + } + if (CarbonVIP != 0) { + output.WriteRawTag(112); + output.WriteInt32(CarbonVIP); + } + if (IdentityInfo != 0) { + output.WriteRawTag(120); + output.WriteInt32(IdentityInfo); + } + deviceStatusList_.WriteTo(ref output, _repeated_deviceStatusList_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HotelCode != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(HotelCode); + } + if (HostNumber.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HostNumber); + } + if (Mac.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Mac); + } + if (EndPoint.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(EndPoint); + } + if (Version.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); + } + if (IsTakeCard != false) { + size += 1 + 1; + } + if (V != 0D) { + size += 1 + 8; + } + if (A != 0D) { + size += 1 + 8; + } + if (P != 0D) { + size += 1 + 8; + } + if (EnergyConsumption_ != 0D) { + size += 1 + 8; + } + if (SumEnergyConsumption != 0D) { + size += 1 + 8; + } + if (CreateTime != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(CreateTime); + } + if (RoomNumber.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RoomNumber); + } + if (CarbonVIP != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(CarbonVIP); + } + if (IdentityInfo != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(IdentityInfo); + } + size += deviceStatusList_.CalculateSize(_repeated_deviceStatusList_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(EnergyConsumption other) { + if (other == null) { + return; + } + if (other.HotelCode != 0L) { + HotelCode = other.HotelCode; + } + if (other.HostNumber.Length != 0) { + HostNumber = other.HostNumber; + } + if (other.Mac.Length != 0) { + Mac = other.Mac; + } + if (other.EndPoint.Length != 0) { + EndPoint = other.EndPoint; + } + if (other.Version.Length != 0) { + Version = other.Version; + } + if (other.IsTakeCard != false) { + IsTakeCard = other.IsTakeCard; + } + if (other.V != 0D) { + V = other.V; + } + if (other.A != 0D) { + A = other.A; + } + if (other.P != 0D) { + P = other.P; + } + if (other.EnergyConsumption_ != 0D) { + EnergyConsumption_ = other.EnergyConsumption_; + } + if (other.SumEnergyConsumption != 0D) { + SumEnergyConsumption = other.SumEnergyConsumption; + } + if (other.CreateTime != 0L) { + CreateTime = other.CreateTime; + } + if (other.RoomNumber.Length != 0) { + RoomNumber = other.RoomNumber; + } + if (other.CarbonVIP != 0) { + CarbonVIP = other.CarbonVIP; + } + if (other.IdentityInfo != 0) { + IdentityInfo = other.IdentityInfo; + } + deviceStatusList_.Add(other.deviceStatusList_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + HotelCode = input.ReadInt64(); + break; + } + case 18: { + HostNumber = input.ReadString(); + break; + } + case 26: { + Mac = input.ReadString(); + break; + } + case 34: { + EndPoint = input.ReadString(); + break; + } + case 42: { + Version = input.ReadString(); + break; + } + case 48: { + IsTakeCard = input.ReadBool(); + break; + } + case 57: { + V = input.ReadDouble(); + break; + } + case 65: { + A = input.ReadDouble(); + break; + } + case 73: { + P = input.ReadDouble(); + break; + } + case 81: { + EnergyConsumption_ = input.ReadDouble(); + break; + } + case 89: { + SumEnergyConsumption = input.ReadDouble(); + break; + } + case 96: { + CreateTime = input.ReadInt64(); + break; + } + case 106: { + RoomNumber = input.ReadString(); + break; + } + case 112: { + CarbonVIP = input.ReadInt32(); + break; + } + case 120: { + IdentityInfo = input.ReadInt32(); + break; + } + case 130: { + deviceStatusList_.AddEntriesFrom(input, _repeated_deviceStatusList_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + HotelCode = input.ReadInt64(); + break; + } + case 18: { + HostNumber = input.ReadString(); + break; + } + case 26: { + Mac = input.ReadString(); + break; + } + case 34: { + EndPoint = input.ReadString(); + break; + } + case 42: { + Version = input.ReadString(); + break; + } + case 48: { + IsTakeCard = input.ReadBool(); + break; + } + case 57: { + V = input.ReadDouble(); + break; + } + case 65: { + A = input.ReadDouble(); + break; + } + case 73: { + P = input.ReadDouble(); + break; + } + case 81: { + EnergyConsumption_ = input.ReadDouble(); + break; + } + case 89: { + SumEnergyConsumption = input.ReadDouble(); + break; + } + case 96: { + CreateTime = input.ReadInt64(); + break; + } + case 106: { + RoomNumber = input.ReadString(); + break; + } + case 112: { + CarbonVIP = input.ReadInt32(); + break; + } + case 120: { + IdentityInfo = input.ReadInt32(); + break; + } + case 130: { + deviceStatusList_.AddEntriesFrom(ref input, _repeated_deviceStatusList_codec); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/消费/Program.cs b/消费/Program.cs new file mode 100644 index 0000000..0aa522d --- /dev/null +++ b/消费/Program.cs @@ -0,0 +1,123 @@ +using BLWData.Entity; +using Confluent.Kafka; +using static Confluent.Kafka.ConfigPropertyNames; + +namespace 消费 +{ + internal class Program + { + static void Main(string[] args) + { + RunConsumers().Wait(); + Console.WriteLine("Hello, World!"); + Console.ReadKey(); + + } + + + + //private const string TopicName = "firsttopic"; + private const string TopicName = "blwlog4BaoJing-rcu-udppackage-topic"; + private const string BootstrapServers = "43.138.217.154:9092"; + private const string GroupId = "parallel-consumer-group"; + private const int ConsumerCount = 3; // 启动3个消费者 + + public static async Task RunConsumers() + { + var cts = new CancellationTokenSource(); + + var consumers = new List(); + for (int i = 0; i < 1; i++) + { + consumers.Add(Task.Run(() => StartConsumer(cts.Token))); + } + + await Task.WhenAll(consumers); + + //await StartConsumer(cts.Token); + } + + private static async Task StartConsumer(CancellationToken cancellationToken) + { + //var config = new ConsumerConfig + //{ + // BootstrapServers = BootstrapServers, + // GroupId = GroupId, + // AutoOffsetReset = AutoOffsetReset.Earliest, + // SecurityProtocol = SecurityProtocol.SaslPlaintext, + // SaslMechanism = SaslMechanism.Plain, + // EnableAutoCommit = true, // 手动提交偏移量 + // EnablePartitionEof = true, + // AllowAutoCreateTopics = true, + // SaslUsername = "aaa", + // SaslPassword = "aaa123" + //}; + + var config = new ConsumerConfig + { + GroupId = "laravel-consumer-kafka-group", + AutoOffsetReset = AutoOffsetReset.Earliest, + //BootstrapServers = BootstrapServers, + BootstrapServers = "43.138.217.154:9092", + SecurityProtocol = SecurityProtocol.SaslPlaintext, + SaslMechanism = SaslMechanism.Plain, + EnableAutoCommit = true, // 手动提交偏移量 + SaslUsername = "baojing", + SaslPassword = "blwmaigong##2025" + + }; + + var consumer = new ConsumerBuilder(config).Build(); + //var consumer = new ConsumerBuilder(config).SetErrorHandler((_, e) => Console.WriteLine($"消费者错误: {e.Reason}")).SetPartitionsAssignedHandler((c, partitions) => + // { + // Console.WriteLine($"消费者分配到分区: {string.Join(", ", partitions)}"); + // }).Build(); + consumer.Subscribe(TopicName); + + try + { + while (!cancellationToken.IsCancellationRequested) + { + try + { + var consumeResult = consumer.Consume(cancellationToken); + + var k = consumeResult.Message.Key; + var v = consumeResult.Message.Value; + EnergyConsumption ese = new EnergyConsumption(); + + if (k.Equals("")) + { + + } + var SSA = EnergyConsumption.Parser.ParseFrom(v); + if (consumeResult.IsPartitionEOF) + { + Console.WriteLine($"消费者1到达分区末尾: {consumeResult.TopicPartitionOffset}"); + continue; + } + + Console.WriteLine($"消费者1收到消息: [分区{consumeResult.Partition}] " + + $"偏移量{consumeResult.Offset}: {consumeResult.Message.Value}"); + + // 手动提交偏移量 + //consumer.Commit(consumeResult); + } + catch (ConsumeException e) + { + Console.WriteLine($"消费者消费错误: {e.Error.Reason}"); + } + } + } + catch (Exception) + { + + } + finally + { + consumer.Close(); + } + await Task.CompletedTask; + } + } +} diff --git a/消费/消费.csproj b/消费/消费.csproj new file mode 100644 index 0000000..2d1a473 --- /dev/null +++ b/消费/消费.csproj @@ -0,0 +1,16 @@ + + + + Exe + net8.0 + enable + enable + 消费.Program + + + + + + + +