初始化
This commit is contained in:
88
.gitignore
vendored
Normal file
88
.gitignore
vendored
Normal file
@@ -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
|
||||
13
BLWLogProduce/.config/dotnet-tools.json
Normal file
13
BLWLogProduce/.config/dotnet-tools.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "9.0.7",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
55
BLWLogProduce/2.txt
Normal file
55
BLWLogProduce/2.txt
Normal file
@@ -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
|
||||
30
BLWLogProduce/BLWLogProduce.csproj
Normal file
30
BLWLogProduce/BLWLogProduce.csproj
Normal file
@@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Confluent.Kafka" Version="2.11.0" />
|
||||
<PackageReference Include="Google.Protobuf" Version="3.32.0" />
|
||||
<PackageReference Include="MessagePack" Version="3.1.4" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog" Version="6.0.2" />
|
||||
<PackageReference Include="NLog.Schema" Version="6.0.2" />
|
||||
<PackageReference Include="RestSharp" Version="112.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommonEntity\CommonEntity.csproj" />
|
||||
<ProjectReference Include="..\CommonTools\CommonTools.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Para_copy.yaml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
12
BLWLogProduce/BLWLogProduce.csproj.user
Normal file
12
BLWLogProduce/BLWLogProduce.csproj.user
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ActiveDebugProfile>http</ActiveDebugProfile>
|
||||
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
|
||||
<NameOfLastUsedPublishProfile>E:\tian\BLS\BLWLogServer\BLWLogProduce\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
6
BLWLogProduce/BLWLogProduce.http
Normal file
6
BLWLogProduce/BLWLogProduce.http
Normal file
@@ -0,0 +1,6 @@
|
||||
@BLWLogProduce_HostAddress = http://localhost:5092
|
||||
|
||||
GET {{BLWLogProduce_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
23
BLWLogProduce/Controllers/HeartBeatController.cs
Normal file
23
BLWLogProduce/Controllers/HeartBeatController.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
33
BLWLogProduce/Controllers/WeatherForecastController.cs
Normal file
33
BLWLogProduce/Controllers/WeatherForecastController.cs
Normal file
@@ -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<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IEnumerable<WeatherForecast> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
1332
BLWLogProduce/EnergyConsumption.cs
Normal file
1332
BLWLogProduce/EnergyConsumption.cs
Normal file
File diff suppressed because it is too large
Load Diff
21
BLWLogProduce/EnergyConsumption.proto
Normal file
21
BLWLogProduce/EnergyConsumption.proto
Normal file
@@ -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;
|
||||
}
|
||||
61
BLWLogProduce/Models/WaiBuJianKong.cs
Normal file
61
BLWLogProduce/Models/WaiBuJianKong.cs
Normal file
@@ -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";
|
||||
}
|
||||
}
|
||||
5069
BLWLogProduce/NLog.xsd
Normal file
5069
BLWLogProduce/NLog.xsd
Normal file
File diff suppressed because it is too large
Load Diff
693
BLWLogProduce/NewActionChangeDataPush.cs
Normal file
693
BLWLogProduce/NewActionChangeDataPush.cs
Normal file
@@ -0,0 +1,693 @@
|
||||
// <auto-generated>
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: NewActionChangeDataPush.proto
|
||||
// </auto-generated>
|
||||
#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 {
|
||||
|
||||
/// <summary>Holder for reflection information generated from NewActionChangeDataPush.proto</summary>
|
||||
public static partial class NewActionChangeDataPushReflection {
|
||||
|
||||
#region Descriptor
|
||||
/// <summary>File descriptor for NewActionChangeDataPush.proto</summary>
|
||||
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
|
||||
/// <summary>
|
||||
/// 定义一个Person消息类型
|
||||
/// </summary>
|
||||
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
|
||||
public sealed partial class NewActionChangeDataPush : pb::IMessage<NewActionChangeDataPush>
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
, pb::IBufferMessage
|
||||
#endif
|
||||
{
|
||||
private static readonly pb::MessageParser<NewActionChangeDataPush> _parser = new pb::MessageParser<NewActionChangeDataPush>(() => new NewActionChangeDataPush());
|
||||
private pb::UnknownFieldSet _unknownFields;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pb::MessageParser<NewActionChangeDataPush> 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);
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "code" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "roomNumber" field.</summary>
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "hostNumber" field.</summary>
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "address" field.</summary>
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "name" field.</summary>
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "status" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "brightness" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "currentTemp" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "settingTemp" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "fanSpeed" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "mode" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "valve" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "createtime" field.</summary>
|
||||
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
|
||||
60
BLWLogProduce/Para_copy.yaml
Normal file
60
BLWLogProduce/Para_copy.yaml
Normal file
@@ -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}
|
||||
32
BLWLogProduce/Program.cs
Normal file
32
BLWLogProduce/Program.cs
Normal file
@@ -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<KafkaProduce>();
|
||||
builder.Services.AddHostedService<MyTimer>();
|
||||
|
||||
builder.Services.AddMemoryCache();
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
41
BLWLogProduce/Properties/launchSettings.json
Normal file
41
BLWLogProduce/Properties/launchSettings.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
BLWLogProduce/Services/CPUDataCollect.cs
Normal file
27
BLWLogProduce/Services/CPUDataCollect.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
using CommonTools;
|
||||
|
||||
namespace BLWLogProduce.Services
|
||||
{
|
||||
public class CPUDataCollect : BackgroundService
|
||||
{
|
||||
public static ConcurrentBag<double> CPU_Data = new ConcurrentBag<double>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
53
BLWLogProduce/Services/CRICS_P_C.cs
Normal file
53
BLWLogProduce/Services/CRICS_P_C.cs
Normal file
@@ -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<string> _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<string>();
|
||||
await ConsumeMessagesAsync();
|
||||
var wireshark = ("crics-udp-package", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await _messageChannel.Writer.WriteAsync("");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}));
|
||||
|
||||
CSRedisCacheHelper.redis3.Subscribe(wireshark);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
729
BLWLogProduce/Services/KafkaProduce.cs
Normal file
729
BLWLogProduce/Services/KafkaProduce.cs
Normal file
@@ -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<string, byte[]>(config).Build();
|
||||
//var p = new ProducerBuilder<string, byte[]>(config).Build();
|
||||
|
||||
///udp 采集数据
|
||||
var wireshark = ("wireshark-cap-udp-totalcount", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
WaiBuJianKong.data.WireShark_UDPCapCount = args.Body;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}));
|
||||
///udp 采集数据
|
||||
var DingYue = ("redis-udppackage", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
string body = args.Body;
|
||||
//Console.WriteLine("UDPData:"+body);
|
||||
UDPPackage? usa = System.Text.Json.JsonSerializer.Deserialize<UDPPackage>(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<string>(item.Key, Location, DateTimeOffset.Now.AddHours(1));
|
||||
}
|
||||
QQQ[item.Key] = Location;
|
||||
}
|
||||
}
|
||||
byte[] bytes = MyMessagePacker.FastSerialize(usa);
|
||||
|
||||
//byte[] bytes = MessagePackSerializer.Serialize<UDPPackage>(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<string, byte[]> { Key = DetailKey, Value = Encoding.UTF8.GetBytes(body) });
|
||||
var dr = await p.ProduceAsync(TopicKey, new Message<string, byte[]> { 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<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
string body = args.Body;
|
||||
|
||||
StepInfo? usa = System.Text.Json.JsonSerializer.Deserialize<StepInfo>(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<string, byte[]> { Key = DetailKey, Value = bytes });
|
||||
|
||||
|
||||
//await _messageChannel.Writer.WriteAsync("");
|
||||
}));
|
||||
|
||||
//旁路系统
|
||||
var DingYue2 = ("redis-forksystemdata", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
string body = args.Body;
|
||||
|
||||
ForkSystem? forkSystem = System.Text.Json.JsonSerializer.Deserialize<ForkSystem>(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<string, byte[]> { Key = DetailKey, Value = qf });
|
||||
|
||||
|
||||
//await Task.Factory.StartNew(async () =>
|
||||
// {
|
||||
// await ConsumeMessagesAsync();
|
||||
// }, TaskCreationOptions.LongRunning);
|
||||
}));
|
||||
|
||||
///能耗
|
||||
var DingYue3 = ("redis-power", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
string body = args.Body;
|
||||
|
||||
try
|
||||
{
|
||||
NengHao? poo = System.Text.Json.JsonSerializer.Deserialize<NengHao>(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<string, byte[]> { Key = DetailKey, Value = qf });
|
||||
|
||||
|
||||
List<DeviceData> la = new List<DeviceData>();
|
||||
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<string, byte[]> { Key = DetailKey1, Value = data });
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}));
|
||||
|
||||
var DingYue3_1 = ("redis-action-data", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
string body = args.Body;
|
||||
|
||||
try
|
||||
{
|
||||
NewRoomtusPush? poo = System.Text.Json.JsonSerializer.Deserialize<NewRoomtusPush>(body);
|
||||
//byte[] qf = MyMessagePacker.FastSerialize(poo);
|
||||
//string TopicKey = KafkaKey.BLWLog_RCU_Topic;
|
||||
//string DetailKey = KafkaKey.UDPPackagePowerMonitor;
|
||||
//await p.ProduceAsync(TopicKey, new Message<string, byte[]> { 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<string, byte[]> { Key = DetailKey1, Value = data });
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
#region 碳达人
|
||||
//var DingYue3_1 = ("redis-carbon_trigger", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
//{
|
||||
// string body = args.Body;
|
||||
|
||||
// NengHao? poo = System.Text.Json.JsonSerializer.Deserialize<NengHao>(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<string, byte[]> { 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<string, byte[]> { Key = DetailKey1, Value = data });
|
||||
|
||||
//}));
|
||||
#endregion
|
||||
|
||||
|
||||
//给宝镜推送数据 ,本意是推送原始的二进制,没有解析过的数据
|
||||
var DingYue10 = ("redis-baojing-powerdata", new Action<SubscribeMessageEventArgs>(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<string, byte[]> { Key = DetailKey, Value = hexdata });
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("宝镜错误数为:" + body);
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
//小度
|
||||
var DingYue5 = ("redis-iotpackage", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
string body = args.Body;
|
||||
IOTMonitorData? usa = System.Text.Json.JsonSerializer.Deserialize<IOTMonitorData>(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<string, byte[]> { Key = DetailKey, Value = bytes });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}));
|
||||
|
||||
//在线离线状态
|
||||
var DingYue6 = ("redis-on_off_line", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
string body = args.Body;
|
||||
OnOffLineData? usa = System.Text.Json.JsonSerializer.Deserialize<OnOffLineData>(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<string, byte[]> { 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<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
string body = args.Body;
|
||||
MTakeCardData? usa = System.Text.Json.JsonSerializer.Deserialize<MTakeCardData>(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<string, byte[]> { Key = DetailKey, Value = bytes });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
|
||||
//服务状态变化
|
||||
var DingYue8 = ("redis-serviceinfo_change", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
string body = args.Body;
|
||||
OtherServiceInfo? usa = System.Text.Json.JsonSerializer.Deserialize<OtherServiceInfo>(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<string, byte[]> { Key = DetailKey, Value = bytes });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
//第三方接口调用日志
|
||||
var DingYue9 = ("redis-invoke_httpinterface", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
string body = args.Body;
|
||||
Interface3Log? usa = System.Text.Json.JsonSerializer.Deserialize<Interface3Log>(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<string, byte[]> { Key = DetailKey, Value = bytes });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}));
|
||||
|
||||
#region 新版本协议
|
||||
//新版主机数据重启原因
|
||||
var DingYue11 = ("redis-rcu-restart", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
string body = args.Body;
|
||||
NewVersionHexData? usa = System.Text.Json.JsonSerializer.Deserialize<NewVersionHexData>(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<string, byte[]> { Key = DetailKey, Value = bytes });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}));
|
||||
|
||||
//取电状态
|
||||
var DingYue12 = ("redis-rcu-card_action", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
string body = args.Body;
|
||||
NewVersionHexData? usa = System.Text.Json.JsonSerializer.Deserialize<NewVersionHexData>(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<string, byte[]> { Key = DetailKey, Value = bytes });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}));
|
||||
|
||||
//设备动作状态
|
||||
var DingYue13 = ("redis-rcu-hexdata", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
string body = args.Body;
|
||||
NewVersionHexData? usa = System.Text.Json.JsonSerializer.Deserialize<NewVersionHexData>(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<string, byte[]> { Key = DetailKey, Value = bytes });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}));
|
||||
//注册
|
||||
var DingYue14 = ("redis-rcu-registerdata", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
string body = args.Body;
|
||||
NewVersionHexData? usa = System.Text.Json.JsonSerializer.Deserialize<NewVersionHexData>(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<string, byte[]> { Key = DetailKey, Value = bytes });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}));
|
||||
|
||||
//定时上报
|
||||
var DingYue15 = ("redis-rcu-timer_data", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
string body = args.Body;
|
||||
NewVersionHexData? usa = System.Text.Json.JsonSerializer.Deserialize<NewVersionHexData>(body);
|
||||
byte[] bytes = MyMessagePacker.FastSerialize(usa);
|
||||
string TopicKey = KafkaKey.BLWLog_RCU_Topic;
|
||||
string DetailKey = KafkaKey.RCUNewTimerData;
|
||||
var dr = await p.ProduceAsync(TopicKey, new Message<string, byte[]> { 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<string>();
|
||||
//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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 百度api
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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<Root>(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))
|
||||
//{ }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
92
BLWLogProduce/Services/MyTimer.cs
Normal file
92
BLWLogProduce/Services/MyTimer.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
26
BLWLogProduce/Services/RoomStatusDataCollect.cs
Normal file
26
BLWLogProduce/Services/RoomStatusDataCollect.cs
Normal file
@@ -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<SubscribeMessageEventArgs>((args) =>
|
||||
{
|
||||
string body = args.Body;
|
||||
string TopicKey = KafkaKey.BLWLog_RCU_Topic;
|
||||
string DetailKey = KafkaKey.UDPPackageKey;
|
||||
}));
|
||||
CSRedisCacheHelper.redis.Subscribe(DingYue);
|
||||
|
||||
}, TaskCreationOptions.LongRunning, stoppingToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
BLWLogProduce/WeatherForecast.cs
Normal file
13
BLWLogProduce/WeatherForecast.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
8
BLWLogProduce/appsettings.Development.json
Normal file
8
BLWLogProduce/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
14
BLWLogProduce/appsettings.json
Normal file
14
BLWLogProduce/appsettings.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"Kafka": {
|
||||
"EndPoint": "43.138.217.154:9092",
|
||||
"UserName": "blwmomo",
|
||||
"PassWord": "blwmomo"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
35
BLWLogProduce/nlog.config
Normal file
35
BLWLogProduce/nlog.config
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<!-- enable asp.net core layout renderers -->
|
||||
<targets>
|
||||
<!--项目日志保存文件路径说明fileName="${basedir}/保存目录,以年月日的格式创建/${shortdate}/${记录器名称}-${单级记录}-${shortdate}.txt"-->
|
||||
<target name="info_file" xsi:type="File"
|
||||
fileName="${basedir}/Logs/${shortdate}/info_${shortdate}.txt"
|
||||
layout="${longdate}|${level:uppercase=true}|${logger}|${message}|${exception:format=ToString} ${newline} ${stacktrace} ${newline}"
|
||||
archiveFileName="${basedir}/archives/info_${shortdate}-{#####}.txt"
|
||||
archiveAboveSize="102400"
|
||||
archiveNumbering="Sequence"
|
||||
concurrentWrites="true"
|
||||
keepFileOpen="false" />
|
||||
<target name="error_file" xsi:type="File"
|
||||
fileName="${basedir}/Logs/${shortdate}/error_${shortdate}.txt"
|
||||
layout="${longdate}|${level:uppercase=true}|${logger}|${message}|${exception:format=ToString} ${newline} ${stacktrace} ${newline}"
|
||||
archiveFileName="${basedir}/archives/error_${shortdate}-{#####}.txt"
|
||||
archiveAboveSize="102400"
|
||||
archiveNumbering="Sequence"
|
||||
concurrentWrites="true"
|
||||
keepFileOpen="false" />
|
||||
</targets>
|
||||
|
||||
<!--规则配置,final - 最终规则匹配后不处理任何规则-->
|
||||
<!--规则配置,final - 最终规则匹配后不处理任何规则-->
|
||||
<!--定义使用哪个target输出-->
|
||||
<rules>
|
||||
<!-- 优先级从高到低依次为:OFF、FATAL、ERROR、WARN、INFO、DEBUG、TRACE、 ALL -->
|
||||
<!-- 将所有日志输出到文件 -->
|
||||
<logger name="*" minlevel="FATAL" maxlevel="FATAL" writeTo="info_file" />
|
||||
<logger name="*" minlevel="Error" writeTo="error_file" />
|
||||
</rules>
|
||||
</nlog>
|
||||
169
BLWLogServer.sln
Normal file
169
BLWLogServer.sln
Normal file
@@ -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
|
||||
BIN
BLWLogServer.suo
Normal file
BIN
BLWLogServer.suo
Normal file
Binary file not shown.
13
BLWLogServer/.config/dotnet-tools.json
Normal file
13
BLWLogServer/.config/dotnet-tools.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "9.0.7",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
27
BLWLogServer/BLWLogServer.csproj
Normal file
27
BLWLogServer/BLWLogServer.csproj
Normal file
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Services\KafkaConsume1.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Confluent.Kafka" Version="2.11.0" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="3.4.1" />
|
||||
<PackageReference Include="NLog" Version="6.0.2" />
|
||||
<PackageReference Include="NLog.Schema" Version="6.0.2" />
|
||||
<PackageReference Include="NPOI" Version="2.7.4" />
|
||||
<PackageReference Include="RestSharp" Version="112.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommonEntity\CommonEntity.csproj" />
|
||||
<ProjectReference Include="..\CommonTools\CommonTools.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
8
BLWLogServer/BLWLogServer.csproj.user
Normal file
8
BLWLogServer/BLWLogServer.csproj.user
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<NameOfLastUsedPublishProfile>E:\tian\BLS\BLWLogServer\BLWLogServer\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
|
||||
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
6
BLWLogServer/BLWLogServer.http
Normal file
6
BLWLogServer/BLWLogServer.http
Normal file
@@ -0,0 +1,6 @@
|
||||
@BLWLogServer_HostAddress = http://localhost:5245
|
||||
|
||||
GET {{BLWLogServer_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
54
BLWLogServer/Controllers/PowerController.cs
Normal file
54
BLWLogServer/Controllers/PowerController.cs
Normal file
@@ -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<NengHao_db>("powermonitor");
|
||||
//构建查询条件
|
||||
long code = 0;
|
||||
long.TryParse(query.HotelCode,out code);
|
||||
|
||||
var filter = Builders<NengHao_db>.Filter.And(
|
||||
Builders<NengHao_db>.Filter.Gt(x => x.ReportTime, sst),
|
||||
Builders<NengHao_db>.Filter.Lt(x => x.ReportTime, eet),
|
||||
Builders<NengHao_db>.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
977
BLWLogServer/Controllers/UDPPackageController.cs
Normal file
977
BLWLogServer/Controllers/UDPPackageController.cs
Normal file
@@ -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<UDPPackage_db>("totalcount");
|
||||
//构建查询条件
|
||||
|
||||
var filter = Builders<UDPPackage_db>.Filter.And(
|
||||
Builders<UDPPackage_db>.Filter.Gt(x => x.RemoveTime, sst),
|
||||
Builders<UDPPackage_db>.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<StepInfo_db>("zeroe_stepmonitor");
|
||||
//构建查询条件
|
||||
|
||||
var filter = Builders<StepInfo_db>.Filter.And(
|
||||
Builders<StepInfo_db>.Filter.Gt(x => x.TriggerTime, sst),
|
||||
Builders<StepInfo_db>.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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取语音IOT平台的数据
|
||||
/// </summary>
|
||||
/// <param name="QueryData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
public ReturnInfo Get_IOTLog([FromBody] LogQuery q)
|
||||
{
|
||||
ReturnInfo info = new ReturnInfo();
|
||||
info.isok = true;
|
||||
try
|
||||
{
|
||||
List<IOTMonitorData_db> lg = new List<IOTMonitorData_db>();
|
||||
|
||||
string? st = q?.Start_Time;
|
||||
string? et = q?.End_Time;
|
||||
|
||||
int PageSize = q.PageSize;
|
||||
int PageIndex = q.PageIndex;
|
||||
|
||||
List<string> 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<IOTMonitorData_db> NNN = null;
|
||||
var collection = _client.GetDatabase("udppackage").GetCollection<IOTMonitorData_db>("voiceiotlog");
|
||||
var pipeline = collection.Aggregate();
|
||||
NNN = pipeline.Match(s => s.CreateTime >= sst && s.CreateTime <= eet);
|
||||
|
||||
if (qqqq?.Count > 0)
|
||||
{
|
||||
var orConditions = new List<FilterDefinition<IOTMonitorData_db>>();
|
||||
foreach (var item in qqqq)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.HotelCode) && !string.IsNullOrEmpty(item.RoomNumber))
|
||||
{
|
||||
var andCondition = Builders<IOTMonitorData_db>.Filter.And(
|
||||
Builders<IOTMonitorData_db>.Filter.Eq("HotelCode", item.HotelCode),
|
||||
Builders<IOTMonitorData_db>.Filter.Eq("RoomNumber", item.RoomNumber)
|
||||
);
|
||||
orConditions.Add(andCondition);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(item.HotelCode) && string.IsNullOrEmpty(item.RoomNumber))
|
||||
{
|
||||
var andCondition = Builders<IOTMonitorData_db>.Filter.And(
|
||||
Builders<IOTMonitorData_db>.Filter.Eq("HotelCode", item.HotelCode)
|
||||
);
|
||||
orConditions.Add(andCondition);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
var orFilter = Builders<IOTMonitorData_db>.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<IOTMonitorData_db> lg = new List<IOTMonitorData_db>();
|
||||
|
||||
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<IOTMonitorData_db>("voiceiotlog");
|
||||
//构建查询条件
|
||||
if (q.IsQuery_Really)
|
||||
{
|
||||
|
||||
IAggregateFluent<IOTMonitorData_db> 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<FilterDefinition<IOTMonitorData_db>>();
|
||||
foreach (var item in qqqq)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.HotelCode) && !string.IsNullOrEmpty(item.RoomNumber))
|
||||
{
|
||||
var andCondition = Builders<IOTMonitorData_db>.Filter.And(
|
||||
Builders<IOTMonitorData_db>.Filter.Eq("HotelCode", item.HotelCode),
|
||||
Builders<IOTMonitorData_db>.Filter.Eq("RoomNumber", item.RoomNumber)
|
||||
);
|
||||
orConditions.Add(andCondition);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(item.HotelCode) && string.IsNullOrEmpty(item.RoomNumber))
|
||||
{
|
||||
var andCondition = Builders<IOTMonitorData_db>.Filter.And(
|
||||
Builders<IOTMonitorData_db>.Filter.Eq("HotelCode", item.HotelCode)
|
||||
);
|
||||
orConditions.Add(andCondition);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 将 OR 条件添加到管道
|
||||
var orFilter = Builders<IOTMonitorData_db>.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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///获取取电状态
|
||||
/// </summary>
|
||||
/// <param name="q"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
public async Task<ReturnInfo> Get_TakeCardStatus([FromBody] LogQuery q)
|
||||
{
|
||||
ReturnInfo info = new ReturnInfo();
|
||||
info.isok = true;
|
||||
try
|
||||
{
|
||||
List<IOTMonitorData_db> lg = new List<IOTMonitorData_db>();
|
||||
|
||||
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<MTakeCardData_db>("takecardlog");
|
||||
|
||||
// 定义多个条件组合
|
||||
// 动态条件列表
|
||||
|
||||
|
||||
FilterDefinition<MTakeCardData_db> filter = Builders<MTakeCardData_db>.Filter.And(
|
||||
Builders<MTakeCardData_db>.Filter.Gt(x => x.LastUpdateTime, sst1),
|
||||
Builders<MTakeCardData_db>.Filter.Lt(x => x.LastUpdateTime, eet1)
|
||||
);
|
||||
|
||||
|
||||
var conditions = new List<FilterDefinition<MTakeCardData_db>>();
|
||||
foreach (var item in qqqq)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.HotelCode) && !string.IsNullOrEmpty(item.Key_HostNumber))
|
||||
{
|
||||
var q1 = Builders<MTakeCardData_db>.Filter.And(
|
||||
Builders<MTakeCardData_db>.Filter.Eq("HotelCode", item.HotelCode),
|
||||
Builders<MTakeCardData_db>.Filter.Eq("HostNUMBER", item.Key_HostNumber)
|
||||
);
|
||||
conditions.Add(q1);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(item.HotelCode))
|
||||
{
|
||||
var q1 = Builders<MTakeCardData_db>.Filter.And(
|
||||
Builders<MTakeCardData_db>.Filter.Eq("HotelCode", item.HotelCode)
|
||||
);
|
||||
conditions.Add(q1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 组合所有 HotelCode 和 HostNUMBER 的条件为 OR
|
||||
var combinedHotelHostFilter = conditions.Count > 0
|
||||
? Builders<MTakeCardData_db>.Filter.Or(conditions)
|
||||
: Builders<MTakeCardData_db>.Filter.Empty; // 如果没有条件,则不限制
|
||||
|
||||
// 最终条件:时间范围 AND (HotelCode + HostNUMBER 的 OR 组合)
|
||||
var finalFilter = Builders<MTakeCardData_db>.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<ReturnInfo> 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<MTakeCardData_db>("takecardlog");
|
||||
var collection2 = _client.GetDatabase("udppackage").GetCollection<OnOffLineData_db>("rcustatuslog");
|
||||
|
||||
FilterDefinition<MTakeCardData_db> filter1 = Builders<MTakeCardData_db>.Filter.And(
|
||||
Builders<MTakeCardData_db>.Filter.Lt(x => x.LastUpdateTime, sst1),
|
||||
Builders<MTakeCardData_db>.Filter.Eq(x => x.HotelCode, hotelcode),
|
||||
Builders<MTakeCardData_db>.Filter.Eq(x => x.HostNUMBER, hostnumber)
|
||||
);
|
||||
var finalFilter1 = Builders<MTakeCardData_db>.Filter.And(filter1);
|
||||
var dynamicResults1 = await collection1.Find(finalFilter1).SortByDescending(x => x.LastUpdateTime).Limit(1).FirstOrDefaultAsync();
|
||||
|
||||
FilterDefinition<OnOffLineData_db> filter2 = Builders<OnOffLineData_db>.Filter.And(
|
||||
Builders<OnOffLineData_db>.Filter.Lt(x => x.CurrentTime, sst1),
|
||||
Builders<OnOffLineData_db>.Filter.Eq(x => x.HotelCode, hotelcode),
|
||||
Builders<OnOffLineData_db>.Filter.Eq(x => x.HostNumber, hostnumber)
|
||||
);
|
||||
var finalFilter2 = Builders<OnOffLineData_db>.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<QueryData> items, string hotelcode, string hostnumber)
|
||||
{
|
||||
|
||||
List<bool> bools = new List<bool>();
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RCU 连线,断线状态
|
||||
/// </summary>
|
||||
/// <param name="q"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
public async Task<ReturnInfo> 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<OnOffLineData_db>("rcustatuslog");
|
||||
|
||||
FilterDefinition<OnOffLineData_db> filter = Builders<OnOffLineData_db>.Filter.And(
|
||||
Builders<OnOffLineData_db>.Filter.Gt(x => x.CurrentTime, sst1),
|
||||
Builders<OnOffLineData_db>.Filter.Lt(x => x.CurrentTime, eet1)
|
||||
);
|
||||
|
||||
var conditions = new List<FilterDefinition<OnOffLineData_db>>();
|
||||
conditions.Add(filter);
|
||||
|
||||
foreach (var item in qqq)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.HotelCode) && string.IsNullOrEmpty(item.Key_HostNumber))
|
||||
{
|
||||
var q1 = Builders<OnOffLineData_db>.Filter.And(
|
||||
Builders<OnOffLineData_db>.Filter.Eq("HotelCode", item.HotelCode)
|
||||
);
|
||||
conditions.Add(q1);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(item.HotelCode) && !string.IsNullOrEmpty(item.Key_HostNumber))
|
||||
{
|
||||
var q1 = Builders<OnOffLineData_db>.Filter.And(
|
||||
Builders<OnOffLineData_db>.Filter.Eq("HotelCode", item.HotelCode),
|
||||
Builders<OnOffLineData_db>.Filter.Eq("HostNumber", item.Key_HostNumber)
|
||||
);
|
||||
conditions.Add(q1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 组合所有条件为 AND 关系(时间范围 + 其他条件)
|
||||
var finalFilter = Builders<OnOffLineData_db>.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/";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置时间
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
public async Task<ReturnInfo> 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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 间隔多久的数据会被丢弃
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
public async Task<ReturnInfo> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UDP 几包数据丢一包
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost()]
|
||||
public async Task<ReturnInfo> 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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 同时设置3个数据
|
||||
/// </summary>
|
||||
/// <param name="dataList"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
public async Task<ReturnInfo> ConfigParameterSet(List<TTT> 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<UDPPackage_db>("totalcount");
|
||||
|
||||
// 构建查询条件
|
||||
var filter = Builders<UDPPackage_db>.Filter.And(
|
||||
Builders<UDPPackage_db>.Filter.Gt(x => x.RemoveTime, sst),
|
||||
Builders<UDPPackage_db>.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<ExportDataRow> TransformDataForExport(List<UDPPackage_db> data)
|
||||
{
|
||||
// 提取所有唯一的commandType
|
||||
var types = data.Select(item => item.CommandType).Distinct().ToList();
|
||||
|
||||
// 按分钟间隔分组
|
||||
var groupedByTime = new Dictionary<string, ExportDataRow>();
|
||||
|
||||
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<ExportDataRow> 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<string, long> TypeValues { get; set; }
|
||||
}
|
||||
public class TTT
|
||||
{
|
||||
public string key { get; set; }
|
||||
public int value { get; set; }
|
||||
}
|
||||
}
|
||||
16
BLWLogServer/Controllers/ValuesController.cs
Normal file
16
BLWLogServer/Controllers/ValuesController.cs
Normal file
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
33
BLWLogServer/Controllers/WeatherForecastController.cs
Normal file
33
BLWLogServer/Controllers/WeatherForecastController.cs
Normal file
@@ -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<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IEnumerable<WeatherForecast> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
5069
BLWLogServer/NLog.xsd
Normal file
5069
BLWLogServer/NLog.xsd
Normal file
File diff suppressed because it is too large
Load Diff
49
BLWLogServer/Program.cs
Normal file
49
BLWLogServer/Program.cs
Normal file
@@ -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<IMongoClient>(ppp =>
|
||||
{
|
||||
string? connectionString = builder.Configuration["Mongodb:Connectstr"];
|
||||
//var connectionString = "mongodb://localhost:27017/";
|
||||
var client = new MongoClient(connectionString);
|
||||
return client;
|
||||
});
|
||||
builder.Services.AddHostedService<KafkaConsume>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
app.UseCors("KuaYu");
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
31
BLWLogServer/Properties/launchSettings.json
Normal file
31
BLWLogServer/Properties/launchSettings.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
469
BLWLogServer/Services/KafkaConsume.cs
Normal file
469
BLWLogServer/Services/KafkaConsume.cs
Normal file
@@ -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<long> _cpuMaxQueue = new(10);
|
||||
private static Queue<long> _cpuAvgQueue = new(10);
|
||||
private static Queue<long> _cpuMinQueue = new(10);
|
||||
private static Queue<long> _TotalSendPackage = new(10);
|
||||
private static Queue<long> _TotalRecvPackage = new(10);
|
||||
private static Queue<long> _RCUOnLine = new(10);
|
||||
|
||||
protected async override Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
await Task.Factory.StartNew(async () =>
|
||||
{
|
||||
var consumers = new List<Task>();
|
||||
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<string, byte[]>(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<UDPPackage_db>("totalcount");
|
||||
UDPPackage UDPPPP = MyMessagePacker.FastDeserialize<UDPPackage>(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<StepInfo_db>("zeroe_stepmonitor");
|
||||
StepInfo UDPPPP = MyMessagePacker.FastDeserialize<StepInfo>(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<NengHao_db>("powermonitor");
|
||||
NengHao UDPPPP = MyMessagePacker.FastDeserialize<NengHao>(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<IOTMonitorData_db>("voiceiotlog");
|
||||
IOTMonitorData UDPPPP = MyMessagePacker.FastDeserialize<IOTMonitorData>(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<OnOffLineData_db>("rcustatuslog");
|
||||
OnOffLineData UDPPPP = MyMessagePacker.FastDeserialize<OnOffLineData>(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<Interface3Log_db>("invokehttpinterfacelog");
|
||||
Interface3Log UDPPPP = MyMessagePacker.FastDeserialize<Interface3Log>(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<MTakeCardData_db>("takecardlog");
|
||||
MTakeCardData UDPPPP = MyMessagePacker.FastDeserialize<MTakeCardData>(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<OtherServiceInfo_db>("serviceinfolog");
|
||||
OtherServiceInfo UDPPPP = MyMessagePacker.FastDeserialize<OtherServiceInfo>(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<CheckInYuanShidata_db>("pmslog");
|
||||
CheckInYuanShidata UDPPPP = MyMessagePacker.FastDeserialize<CheckInYuanShidata>(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<NewVersionHexData_db>("rcu_hexdata");
|
||||
NewVersionHexData UDPPPP = MyMessagePacker.FastDeserialize<NewVersionHexData>(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<NewVersionHexData_db>("rcu_hexdata");
|
||||
NewVersionHexData UDPPPP = MyMessagePacker.FastDeserialize<NewVersionHexData>(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<NewVersionHexData_db>("rcu_hexdata");
|
||||
NewVersionHexData UDPPPP = MyMessagePacker.FastDeserialize<NewVersionHexData>(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<NewVersionHexData_db>("rcu_hexdata");
|
||||
NewVersionHexData UDPPPP = MyMessagePacker.FastDeserialize<NewVersionHexData>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
154
BLWLogServer/Services/KafkaConsume1.cs
Normal file
154
BLWLogServer/Services/KafkaConsume1.cs
Normal file
@@ -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<string, byte[]>(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<Interface3Log_db>("invokehttpinterfacelog");
|
||||
Interface3Log UDPPPP = MyMessagePacker.FastDeserialize<Interface3Log>(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<MTakeCardData_db>("takecardlog");
|
||||
MTakeCardData UDPPPP = MyMessagePacker.FastDeserialize<MTakeCardData>(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<OtherServiceInfo_db>("serviceinfolog");
|
||||
OtherServiceInfo UDPPPP = MyMessagePacker.FastDeserialize<OtherServiceInfo>(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<Task>();
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
consumers.Add(Task.Run(() => StartConsumer(stoppingToken)));
|
||||
}
|
||||
|
||||
await Task.WhenAll(consumers);
|
||||
}, TaskCreationOptions.LongRunning);
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
246
BLWLogServer/Services/S.cs
Normal file
246
BLWLogServer/Services/S.cs
Normal file
@@ -0,0 +1,246 @@
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace BLWLogServer.Services
|
||||
{
|
||||
public class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备地址
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
/// <summary>
|
||||
/// 地址类型
|
||||
/// </summary>
|
||||
//public AddressType AddressType { get; set; }
|
||||
/// <summary>
|
||||
/// 设备开关状态:1开,2关,6停(窗帘),下发1个字节
|
||||
/// </summary>
|
||||
public byte Status { get; set; }
|
||||
/// <summary>
|
||||
/// 设备开关状态:1开,2关,6停(窗帘),接收2个字节
|
||||
/// </summary>
|
||||
public ushort StatusReceiver { get; set; }
|
||||
/// <summary>
|
||||
/// 亮度值
|
||||
/// </summary>
|
||||
public byte Brightness { get; set; }
|
||||
/// <summary>
|
||||
/// 温度
|
||||
/// </summary>
|
||||
public byte Temperature { get; set; }
|
||||
/// <summary>
|
||||
/// 风速
|
||||
/// </summary>
|
||||
public byte FanSpeed { get; set; }
|
||||
/// <summary>
|
||||
/// 模式
|
||||
/// </summary>
|
||||
public byte Mode { get; set; }
|
||||
/// <summary>
|
||||
/// 阀门开关
|
||||
/// </summary>
|
||||
public byte Valve { get; set; }
|
||||
/// <summary>
|
||||
/// 空调执行方式和内容
|
||||
/// </summary>
|
||||
public Int32 AirExecMode { get; set; }
|
||||
/// <summary>
|
||||
/// 地暖执行方式和内容
|
||||
/// </summary>
|
||||
public Int32 FloorHotExecMode { get; set; }
|
||||
/// <summary>
|
||||
/// 背景音乐执行方式和内容
|
||||
/// </summary>
|
||||
public Int32 MusicExecMode { get; set; }
|
||||
/// <summary>
|
||||
/// 色温执行方式和内容
|
||||
/// </summary>
|
||||
//public Int32 ColorTempExecMode { get; set; }
|
||||
}
|
||||
public class Status
|
||||
{
|
||||
/// <summary>
|
||||
/// RCU是否锁定
|
||||
/// </summary>
|
||||
public bool SysLock { get; set; }
|
||||
/// <summary>
|
||||
/// 房卡类型
|
||||
/// </summary>
|
||||
public byte CardType { get; set; }
|
||||
/// <summary>
|
||||
/// 房门开关
|
||||
/// </summary>
|
||||
public bool Door { get; set; }
|
||||
/// <summary>
|
||||
/// 电量
|
||||
/// </summary>
|
||||
public ushort ElecQty { get; set; }
|
||||
/// <summary>
|
||||
/// 主机温度
|
||||
/// </summary>
|
||||
public byte HostTemp { get; set; }
|
||||
/// <summary>
|
||||
/// 空调状态
|
||||
/// </summary>
|
||||
public ConcurrentDictionary<byte, AirConditionStatus> AirConditions = new ConcurrentDictionary<byte, AirConditionStatus>();
|
||||
/// <summary>
|
||||
/// 设备状态
|
||||
/// </summary>
|
||||
public ConcurrentDictionary<string, Device> Devices = new ConcurrentDictionary<string, Device>();
|
||||
/// <summary>
|
||||
/// 故障列表
|
||||
/// </summary>
|
||||
public ConcurrentDictionary<string, FaultStaus> Faults = new ConcurrentDictionary<string, FaultStaus>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 空调状态
|
||||
/// </summary>
|
||||
public class AirConditionStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// 空调号
|
||||
/// </summary>
|
||||
public byte AirNo { get; set; }
|
||||
/// <summary>
|
||||
/// 当前温度
|
||||
/// </summary>
|
||||
public int CurrentTemp { get; set; }
|
||||
/// <summary>
|
||||
/// 设定温度
|
||||
/// </summary>
|
||||
public int SettingTemp { get; set; }
|
||||
/// <summary>
|
||||
/// 风机开关
|
||||
/// </summary>
|
||||
public bool OnOff { get; set; }
|
||||
/// <summary>
|
||||
/// 风速:0/停止, 1/低速, 2/中速, 3/高速, 4/自动
|
||||
/// </summary>
|
||||
public int Speed { get; set; }
|
||||
/// <summary>
|
||||
/// 模式: 0/制冷,1/制热,2/送风,3/除湿
|
||||
/// </summary>
|
||||
public int Mode { get; set; }
|
||||
/// <summary>
|
||||
/// 阀状态: 1/阀开,2/阀关
|
||||
/// </summary>
|
||||
public int Valve { get; set; }
|
||||
/// <summary>
|
||||
/// 补偿温度,范围-6.0~6.0
|
||||
/// </summary>
|
||||
public float CompensatoryTemp { get; set; }
|
||||
/// <summary>
|
||||
/// 保温温度
|
||||
/// </summary>
|
||||
public int KeepTemp { get; set; }
|
||||
/// <summary>
|
||||
/// 冷热模式:0/手动,1/自动
|
||||
/// </summary>
|
||||
public int ColdHotMode { get; set; }
|
||||
/// <summary>
|
||||
/// 死区温度
|
||||
/// </summary>
|
||||
public int DeadTemp { get; set; }
|
||||
/// <summary>
|
||||
/// 热偏差
|
||||
/// </summary>
|
||||
public int HotDevition { get; set; }
|
||||
/// <summary>
|
||||
/// 冷偏差
|
||||
/// </summary>
|
||||
public int ColdDevition { get; set; }
|
||||
}
|
||||
|
||||
public class FaultStaus
|
||||
{
|
||||
/// <summary>
|
||||
/// 故障号
|
||||
/// </summary>
|
||||
public string FaultNo { get; set; }
|
||||
/// <summary>
|
||||
/// 类型:1在线状态(0在线,1离线),2电量(0~100%),3电流,4 1901故障检测次数,5设备单个回路状态(0正常,1损坏)
|
||||
/// </summary>
|
||||
public byte Type { get; set; }
|
||||
/// <summary>
|
||||
/// 内容
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
BLWLogServer/WeatherForecast.cs
Normal file
13
BLWLogServer/WeatherForecast.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
8
BLWLogServer/appsettings.Development.json
Normal file
8
BLWLogServer/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
20
BLWLogServer/appsettings.json
Normal file
20
BLWLogServer/appsettings.json
Normal file
@@ -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": "*"
|
||||
}
|
||||
35
BLWLogServer/nlog.config
Normal file
35
BLWLogServer/nlog.config
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<!-- enable asp.net core layout renderers -->
|
||||
<targets>
|
||||
<!--项目日志保存文件路径说明fileName="${basedir}/保存目录,以年月日的格式创建/${shortdate}/${记录器名称}-${单级记录}-${shortdate}.txt"-->
|
||||
<target name="info_file" xsi:type="File"
|
||||
fileName="${basedir}/Logs/${shortdate}/info_${shortdate}.txt"
|
||||
layout="${longdate}|${level:uppercase=true}|${logger}|${message}|${exception:format=ToString} ${newline} ${stacktrace} ${newline}"
|
||||
archiveFileName="${basedir}/archives/info_${shortdate}-{#####}.txt"
|
||||
archiveAboveSize="102400"
|
||||
archiveNumbering="Sequence"
|
||||
concurrentWrites="true"
|
||||
keepFileOpen="false" />
|
||||
<target name="error_file" xsi:type="File"
|
||||
fileName="${basedir}/Logs/${shortdate}/error_${shortdate}.txt"
|
||||
layout="${longdate}|${level:uppercase=true}|${logger}|${message}|${exception:format=ToString} ${newline} ${stacktrace} ${newline}"
|
||||
archiveFileName="${basedir}/archives/error_${shortdate}-{#####}.txt"
|
||||
archiveAboveSize="102400"
|
||||
archiveNumbering="Sequence"
|
||||
concurrentWrites="true"
|
||||
keepFileOpen="false" />
|
||||
</targets>
|
||||
|
||||
<!--规则配置,final - 最终规则匹配后不处理任何规则-->
|
||||
<!--规则配置,final - 最终规则匹配后不处理任何规则-->
|
||||
<!--定义使用哪个target输出-->
|
||||
<rules>
|
||||
<!-- 优先级从高到低依次为:OFF、FATAL、ERROR、WARN、INFO、DEBUG、TRACE、 ALL -->
|
||||
<!-- 将所有日志输出到文件 -->
|
||||
<logger name="*" minlevel="FATAL" maxlevel="FATAL" writeTo="info_file" />
|
||||
<logger name="*" minlevel="Error" writeTo="error_file" />
|
||||
</rules>
|
||||
</nlog>
|
||||
12
ClassLibrary1/B.cs
Normal file
12
ClassLibrary1/B.cs
Normal file
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
12
ClassLibrary1/C.cs
Normal file
12
ClassLibrary1/C.cs
Normal file
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
7
ClassLibrary1/Class1.cs
Normal file
7
ClassLibrary1/Class1.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ClassLibrary1
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
13
ClassLibrary1/ClassLibrary1.csproj
Normal file
13
ClassLibrary1/ClassLibrary1.csproj
Normal file
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--<ItemGroup>
|
||||
<Compile Include="B.cs" OutputAssembly="File1.dll" />
|
||||
<Compile Include="C.cs" OutputAssembly="File2.dll" />
|
||||
</ItemGroup>-->
|
||||
</Project>
|
||||
21
ClassLibrary2/Class1.cs
Normal file
21
ClassLibrary2/Class1.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
ClassLibrary2/ClassLibrary2.csproj
Normal file
13
ClassLibrary2/ClassLibrary2.csproj
Normal file
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MemoryPack" Version="1.21.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
10
ClassLibrary3/Class1.cs
Normal file
10
ClassLibrary3/Class1.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace ClassLibrary3
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
public void FFF()
|
||||
{
|
||||
Console.WriteLine("aaaaaaaaaaaaaaaa");
|
||||
}
|
||||
}
|
||||
}
|
||||
9
ClassLibrary3/ClassLibrary3.csproj
Normal file
9
ClassLibrary3/ClassLibrary3.csproj
Normal file
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
14
CommonEntity/CommonEntity.csproj
Normal file
14
CommonEntity/CommonEntity.csproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MessagePack" Version="3.1.4" />
|
||||
<PackageReference Include="MongoDB.Bson" Version="3.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
153
CommonEntity/DeviceType.cs
Normal file
153
CommonEntity/DeviceType.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 主机继电器
|
||||
/// </summary>
|
||||
[Description("主机继电器")]
|
||||
Relay = 1,
|
||||
/// <summary>
|
||||
/// 弱电输出
|
||||
/// </summary>
|
||||
[Description("弱电输出")]
|
||||
LVout = 3,
|
||||
/// <summary>
|
||||
/// 服务信息
|
||||
/// </summary>
|
||||
[Description("服务信息")]
|
||||
ServiceInfo = 4,
|
||||
/// <summary>
|
||||
/// 窗帘
|
||||
/// </summary>
|
||||
[Description("窗帘")]
|
||||
Curtain = 5,
|
||||
/// <summary>
|
||||
/// 开关扩展
|
||||
/// </summary>
|
||||
[Description("开关扩展")]
|
||||
SwitchExpand = 6,
|
||||
/// <summary>
|
||||
/// 空调
|
||||
/// </summary>
|
||||
[Description("空调")]
|
||||
AirConditioner = 7,
|
||||
/// <summary>
|
||||
/// 红外感应
|
||||
/// </summary>
|
||||
[Description("红外感应")]
|
||||
InFrared = 8,
|
||||
/// <summary>
|
||||
/// 空气质量检测
|
||||
/// </summary>
|
||||
[Description("空气质量检测")]
|
||||
AirDetect = 9,
|
||||
/// <summary>
|
||||
/// 插卡取电
|
||||
/// </summary>
|
||||
[Description("插卡取电")]
|
||||
CardPower = 10,
|
||||
/// <summary>
|
||||
/// 地暖
|
||||
/// </summary>
|
||||
[Description("地暖")]
|
||||
FloorHot = 11,
|
||||
/// <summary>
|
||||
/// 扩展继电器
|
||||
/// </summary>
|
||||
[Description("扩展继电器")]
|
||||
Expand = 14,
|
||||
/// <summary>
|
||||
/// 电视
|
||||
/// </summary>
|
||||
[Description("电视")]
|
||||
TV = 15,
|
||||
/// <summary>
|
||||
/// LED调光
|
||||
/// </summary>
|
||||
[Description("LED调光")]
|
||||
Dimmer = 16,
|
||||
/// <summary>
|
||||
/// 可控硅调光
|
||||
/// </summary>
|
||||
[Description("可控硅调光")]
|
||||
Traic = 17,
|
||||
/// <summary>
|
||||
/// 灯带调光
|
||||
/// </summary>
|
||||
[Description("灯带调光")]
|
||||
Strip = 18,
|
||||
/// <summary>
|
||||
/// PWM调光
|
||||
/// </summary>
|
||||
[Description("PWM调光")]
|
||||
PWMDimmer = 23,
|
||||
/// <summary>
|
||||
/// PWM扩展
|
||||
/// </summary>
|
||||
[Description("PWM扩展")]
|
||||
PWMExpand = 24,
|
||||
/// <summary>
|
||||
/// 音乐
|
||||
/// </summary>
|
||||
[Description("音乐")]
|
||||
Music = 21,
|
||||
/// <summary>
|
||||
/// 微信锁
|
||||
/// </summary>
|
||||
[Description("微信锁")]
|
||||
WXLock = 20,
|
||||
/// <summary>
|
||||
/// PB LED
|
||||
/// </summary>
|
||||
[Description("PB LED")]
|
||||
PBLED = 25,
|
||||
/// <summary>
|
||||
/// 485A9IO继电器
|
||||
/// </summary>
|
||||
[Description("485A9IO继电器")]
|
||||
A9IORelay = 28,
|
||||
/// <summary>
|
||||
/// PB20
|
||||
/// </summary>
|
||||
[Description("PB20")]
|
||||
PB20 = 30,
|
||||
/// <summary>
|
||||
/// PB20-LD
|
||||
/// </summary>
|
||||
[Description("PB20-LD")]
|
||||
PB20_LD = 31,
|
||||
/// <summary>
|
||||
/// PB20-LS
|
||||
/// </summary>
|
||||
[Description("PB20-LS")]
|
||||
PB20_LS = 32,
|
||||
/// <summary>
|
||||
/// PB20-RELAY
|
||||
/// </summary>
|
||||
[Description("PB20-RELAY")]
|
||||
PB20_RELAY = 33,
|
||||
/// <summary>
|
||||
/// 色温
|
||||
/// </summary>
|
||||
[Description("色温")]
|
||||
ColorTemp = 34,
|
||||
|
||||
/// <summary>
|
||||
/// 地址是054000001
|
||||
/// </summary>
|
||||
[Description("碳达人")]
|
||||
CarbonVIP = 54,
|
||||
|
||||
//窗帘地址是:013001000
|
||||
[Description("485窗帘")]
|
||||
Curtain485 = 100
|
||||
}
|
||||
}
|
||||
24
CommonEntity/ForkSystem.cs
Normal file
24
CommonEntity/ForkSystem.cs
Normal file
@@ -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; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
170
CommonEntity/Iot.cs
Normal file
170
CommonEntity/Iot.cs
Normal file
@@ -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<IotDeviceData>? 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<IotDeviceData>? 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<IOTMonitorData_db>? 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; }
|
||||
}
|
||||
}
|
||||
30
CommonEntity/LogBase.cs
Normal file
30
CommonEntity/LogBase.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
35
CommonEntity/LogQuery.cs
Normal file
35
CommonEntity/LogQuery.cs
Normal file
@@ -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<QueryData> Data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间片
|
||||
/// </summary>
|
||||
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<string> 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; }
|
||||
|
||||
}
|
||||
}
|
||||
49
CommonEntity/NewVersionHexData.cs
Normal file
49
CommonEntity/NewVersionHexData.cs
Normal file
@@ -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<Dictionary<string, string>>? Data { get; set; }
|
||||
}
|
||||
}
|
||||
123
CommonEntity/PMSData.cs
Normal file
123
CommonEntity/PMSData.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
16
CommonEntity/ReturnInfo.cs
Normal file
16
CommonEntity/ReturnInfo.cs
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
514
CommonEntity/UDPPackage.cs
Normal file
514
CommonEntity/UDPPackage.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 自己用 的系统的主题
|
||||
/// </summary>
|
||||
public static string BLWLog_RCU_Topic = "blwlog-rcu-udppackage-topic";
|
||||
|
||||
/// <summary>
|
||||
/// 新数据会分区
|
||||
/// </summary>
|
||||
public static string BLWLog_RCU_Topic_Partition = "blwlog-data-topic";
|
||||
//public static string BLWLog_RCU_Topic_Partition = "firsttopic";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 宝镜系统使用的数据
|
||||
/// </summary>
|
||||
public static string BLWLog4BaoJing_RCU_Topic = "blwlog4BaoJing-rcu-udppackage-topic";
|
||||
|
||||
/// <summary>
|
||||
/// 设备动作数据
|
||||
/// </summary>
|
||||
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<string, long> 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<string, long> FenLei { get; set; }
|
||||
[Key(3)]
|
||||
public string? RemoveTime { get; set; }
|
||||
|
||||
[Key(4)]
|
||||
public Dictionary<string, string> 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)]
|
||||
/// <summary>
|
||||
/// HostID
|
||||
/// </summary>
|
||||
public int HostID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备类型
|
||||
/// </summary>
|
||||
[Key(1)]
|
||||
public string DeviceType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备地址
|
||||
/// </summary>
|
||||
[Key(2)]
|
||||
public string Address { get; set; }
|
||||
/// <summary>
|
||||
/// 状态:1开,2关
|
||||
/// </summary>
|
||||
|
||||
[Key(3)]
|
||||
public int Status { get; set; }
|
||||
/// <summary>
|
||||
/// 亮度
|
||||
/// </summary>
|
||||
[Key(4)]
|
||||
public int Brightness { get; set; }
|
||||
/// <summary>
|
||||
/// 当前温度
|
||||
/// </summary>
|
||||
[Key(5)]
|
||||
public int CurrentTemp { get; set; }
|
||||
/// <summary>
|
||||
/// 设定温度
|
||||
/// </summary>
|
||||
[Key(6)]
|
||||
public int SettingTemp { get; set; }
|
||||
/// <summary>
|
||||
/// 风速
|
||||
/// </summary>
|
||||
[Key(7)]
|
||||
public int FanSpeed { get; set; }
|
||||
/// <summary>
|
||||
/// 模式
|
||||
/// </summary>
|
||||
[Key(8)]
|
||||
public int Mode { get; set; }
|
||||
/// <summary>
|
||||
/// 阀门
|
||||
/// </summary>
|
||||
[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; }
|
||||
|
||||
/// <summary>
|
||||
/// 能耗
|
||||
/// </summary>
|
||||
[Key(9)]
|
||||
public double Energy_Consumption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总能耗
|
||||
/// </summary>
|
||||
[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<DingShiReportDate>? AllDeviceData { get; set; }
|
||||
|
||||
[Key(16)]
|
||||
public int IdentityInfo { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject()]
|
||||
public class NewRoomtusPush
|
||||
{
|
||||
/// <summary>
|
||||
/// 酒店编码
|
||||
/// </summary>
|
||||
[Key(0)]
|
||||
public long code { get; set; }
|
||||
|
||||
[Key(1)]
|
||||
public string hostnumber { get; set; }
|
||||
/// <summary>
|
||||
/// 房号
|
||||
/// </summary>
|
||||
[Key(2)]
|
||||
public string roomNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 回路地址
|
||||
/// </summary>
|
||||
|
||||
[Key(3)]
|
||||
public string address { get; set; }
|
||||
/// <summary>
|
||||
/// 回路名称
|
||||
/// </summary>
|
||||
[Key(4)]
|
||||
public string name { get; set; }
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
[Key(5)]
|
||||
public int status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 亮度
|
||||
/// </summary>
|
||||
[Key(6)]
|
||||
public int brightness { get; set; }
|
||||
/// <summary>
|
||||
/// 当前温度
|
||||
/// </summary>
|
||||
[Key(7)]
|
||||
public int currentTemp { get; set; }
|
||||
/// <summary>
|
||||
/// 设定温度
|
||||
/// </summary>
|
||||
[Key(8)]
|
||||
public int settingTemp { get; set; }
|
||||
/// <summary>
|
||||
/// 风速
|
||||
/// </summary>
|
||||
[Key(9)]
|
||||
public int fanSpeed { get; set; }
|
||||
/// <summary>
|
||||
/// 模式
|
||||
/// </summary>
|
||||
[Key(10)]
|
||||
public int mode { get; set; }
|
||||
/// <summary>
|
||||
/// 阀门
|
||||
/// </summary>
|
||||
[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<string, long> FenLei { get; set; }
|
||||
public Dictionary<string, string> 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<DingShiReportDate>? 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<DataItem> data { get; set; }
|
||||
}
|
||||
public class DataItem
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ExtendedLocation { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string OriginQuery { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string appinfo { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int disp_type { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string fetchkey { get; set; }
|
||||
/// <summary>
|
||||
/// 本地局域网
|
||||
/// </summary>
|
||||
public string location { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string origip { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string origipquery { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string resourceid { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int role_id { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int shareImage { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int showLikeShare { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string showlamp { get; set; }
|
||||
/// <summary>
|
||||
/// IP地址查询
|
||||
/// </summary>
|
||||
public string titlecont { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string tplt { get; set; }
|
||||
}
|
||||
}
|
||||
21
CommonTools/CPUData.cs
Normal file
21
CommonTools/CPUData.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
164
CommonTools/CSRedisCacheHelper.cs
Normal file
164
CommonTools/CSRedisCacheHelper.cs
Normal file
@@ -0,0 +1,164 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Configuration;
|
||||
using CSRedis;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Redis缓存辅助类
|
||||
/// </summary>
|
||||
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");
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加缓存
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="value"></param>
|
||||
public static void Set<T>(string key, T value, int ExpireTime)
|
||||
{
|
||||
redis?.Set(key, value, ExpireTime * 60);
|
||||
}
|
||||
|
||||
public static T Get<T>(string key)
|
||||
{
|
||||
return redis.Get<T>(key);
|
||||
}
|
||||
|
||||
public static void Forever<T>(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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否存在
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="mac"></param>
|
||||
/// <returns></returns>
|
||||
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<T>(string key, int SliceNo = 2)
|
||||
{
|
||||
CSRedisClient client = WhitchRedisSlice(SliceNo);
|
||||
return client.Get<T>(key);
|
||||
}
|
||||
public static void Set_Partition<T>(string key, T value, int SliceNo = 2)
|
||||
{
|
||||
CSRedisClient client = WhitchRedisSlice(SliceNo);
|
||||
client.Set(key, value, ExpireMinutes * 60 * 60);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置过期时间
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="ExpireTime_Minutes"></param>
|
||||
/// <param name="SliceNo"></param>
|
||||
public static void Set_PartitionWithTime<T>(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<T>(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<T>(string key)
|
||||
{
|
||||
return redis.Ttl(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
CommonTools/CommonTools.csproj
Normal file
15
CommonTools/CommonTools.csproj
Normal file
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CSRedisCore" Version="3.8.805" />
|
||||
<PackageReference Include="MessagePack" Version="3.1.4" />
|
||||
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="9.0.8" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
44
CommonTools/MyMessagePacker.cs
Normal file
44
CommonTools/MyMessagePacker.cs
Normal file
@@ -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 t)
|
||||
{
|
||||
byte[] bytes = MessagePackSerializer.Serialize(t);
|
||||
return bytes;
|
||||
}
|
||||
public static T FastDeserialize<T>(byte[] bytes)
|
||||
{
|
||||
T mc2 = MessagePackSerializer.Deserialize<T>(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; } }
|
||||
}
|
||||
}
|
||||
628
CommonTools/Tools.cs
Normal file
628
CommonTools/Tools.cs
Normal file
@@ -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
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 获取本地IP地址
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 将主机名或 IP 地址解析IP地址
|
||||
/// </summary>
|
||||
/// <param name="domain"></param>
|
||||
/// <returns></returns>
|
||||
public static IPAddress GetIPByDomain(string hostNameOrAddress)
|
||||
{
|
||||
IPHostEntry host = Dns.GetHostEntry(hostNameOrAddress);
|
||||
return host.AddressList[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取本地IP地址列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static IList<string> GetLocalIPList()
|
||||
{
|
||||
IList<string> localIpList = new List<string>();
|
||||
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取记录访问量文件路径
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetCounterFilePath()
|
||||
{
|
||||
return GetApplicationPath() + @"License\counter.txt";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成CRC16校验
|
||||
/// </summary>
|
||||
/// <param name="buffer"></param>
|
||||
/// <param name="len"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算文件的MD5值
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
public static byte[] MD5(string file)
|
||||
{
|
||||
using (Stream stream = File.Open(file, FileMode.Open))
|
||||
{
|
||||
return MD5(stream);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算流的MD5值
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <returns></returns>
|
||||
public static byte[] MD5(Stream stream)
|
||||
{
|
||||
using (MD5 md5 = new MD5CryptoServiceProvider())
|
||||
{
|
||||
return md5.ComputeHash(stream);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算文件MD5
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <returns></returns>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将MD5字符串转换成整型数组表示
|
||||
/// </summary>
|
||||
/// <param name="md5"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 用MD5加密字符串
|
||||
/// </summary>
|
||||
/// <param name="str">待加密的字符串</param>
|
||||
/// <returns></returns>
|
||||
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();
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取指定长的的字符串对应的16进制字节码,如果长度不够,末位自动补0
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取一个随机数组
|
||||
/// </summary>
|
||||
/// <param name="num">数组个数</param>
|
||||
/// <param name="minValue"></param>
|
||||
/// <param name="maxValue"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解决下载名称在IE下中文乱码
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
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();
|
||||
}
|
||||
/// <summary>
|
||||
/// 字节内容转换为字符串
|
||||
/// </summary>
|
||||
/// <param name="bytesData"></param>
|
||||
/// <returns></returns>
|
||||
public static string ByteToString(byte[] bytesData)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
foreach (byte r in bytesData)
|
||||
{
|
||||
result.Append(r.ToString("X2") + " ");
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// 把int32类型的数据转存到2个字节的byte数组中
|
||||
/// </summary>
|
||||
/// <param name="m">int32类型的数据</param>
|
||||
/// <param name="arry">2个字节大小的byte数组</param>
|
||||
/// <returns></returns>
|
||||
public static byte[] Int32ToByte(Int32 data)
|
||||
{
|
||||
byte[] arry = new byte[2];
|
||||
arry[0] = (byte)((data & 0xFF00) >> 8);
|
||||
arry[1] = (byte)(data & 0xFF);
|
||||
return arry;
|
||||
}
|
||||
/// <summary>
|
||||
/// 把int32类型的数据转存到2个字节的byte数组中:小端
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 2位byte转换为int类型
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static int ByteToInt(byte[] data)
|
||||
{
|
||||
return (data[1] & 0xFF) << 8 | data[0];
|
||||
}
|
||||
/// <summary>
|
||||
/// 4位byte转换为long类型
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static long Byte4ToLong(byte[] data)
|
||||
{
|
||||
return (data[3] << 24) & 0xFF | (data[2] & 0xFF00) << 16 | (data[1] & 0xFF) << 8 | data[0];
|
||||
}
|
||||
/// <summary>
|
||||
/// long类型转换为4位byte
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 在指定时间过后执行指定的表达式
|
||||
/// </summary>
|
||||
/// <param name="interval">事件之间经过的时间(以毫秒为单位)</param>
|
||||
/// <param name="action">要执行的表达式</param>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到字符串的长度,一个汉字算2个字符
|
||||
/// </summary>
|
||||
/// <param name="str">字符串</param>
|
||||
/// <returns>返回字符串长度</returns>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取枚举描述
|
||||
/// </summary>
|
||||
/// <param name="en">枚举</param>
|
||||
/// <returns>返回枚举的描述 </returns>
|
||||
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();
|
||||
}
|
||||
/// <summary>
|
||||
/// stream to reader
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <returns></returns>
|
||||
public static string StreamToString(Stream stream)
|
||||
{
|
||||
stream.Position = 0;
|
||||
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
||||
{
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// HEX编码转换为——>ASCII编码
|
||||
/// </summary>
|
||||
/// <param name="Msg"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// HEX编码转换为——>字符串
|
||||
/// </summary>
|
||||
/// <param name="Msg"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 字符串转化为——>HEX编码
|
||||
/// </summary>
|
||||
/// <param name="Msg"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// Hex文件解释
|
||||
/// </summary>
|
||||
/// <param name="filepath"></param>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 将url参数转成json
|
||||
/// </summary>
|
||||
/// <param name="urlParams"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 格林尼治时间
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 16进制字符串转换成 字节数组
|
||||
/// </summary>
|
||||
/// <param name="hexString"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
ConsoleApp1/MLModel1.mbconfig
Normal file
14
ConsoleApp1/MLModel1.mbconfig
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"Scenario": "Default",
|
||||
"Environment": {
|
||||
"Type": "LocalCPU",
|
||||
"Version": 1
|
||||
},
|
||||
"Type": "TrainingConfig",
|
||||
"Version": 5,
|
||||
"TrainingOption": {
|
||||
"Version": 1,
|
||||
"Type": "DefaultTrainingOption",
|
||||
"TrainingTime": 0
|
||||
}
|
||||
}
|
||||
165
ConsoleApp1/Program.cs
Normal file
165
ConsoleApp1/Program.cs
Normal file
@@ -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<StepInfo_db>("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<LogBase>("udppackage");
|
||||
|
||||
List<LogBase> list1 = new List<LogBase>();
|
||||
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<BsonDocument>("udppackage");
|
||||
|
||||
//构建查询条件
|
||||
var filter = Builders<BsonDocument>.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<string, string>(config).Build())
|
||||
{
|
||||
try
|
||||
{
|
||||
//UDPPackage u = new UDPPackage();
|
||||
//u.CommandType = "aaa";
|
||||
//u.FenLei = new Dictionary<string, long>();
|
||||
//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<string, string> { 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<string, string> { 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<string, string> { 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<string, string> { Key = "testtest", Value = "hello2"});
|
||||
Console.WriteLine($"Delivered '{dr.Value}' to '{dr.TopicPartitionOffset}'");
|
||||
}
|
||||
}
|
||||
catch (ProduceException<string, string> e)
|
||||
{
|
||||
Console.WriteLine($"Delivery failed: {e.Error.Reason}");
|
||||
}
|
||||
}
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
ConsoleApp1/发布.csproj
Normal file
20
ConsoleApp1/发布.csproj
Normal file
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Confluent.Kafka" Version="2.11.0" />
|
||||
<PackageReference Include="MongoDB.Bson" Version="3.4.1" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="3.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommonEntity\CommonEntity.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
21
ConsoleApp2/ConsoleApp2.csproj
Normal file
21
ConsoleApp2/ConsoleApp2.csproj
Normal file
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.32.1" />
|
||||
<PackageReference Include="MessagePack" Version="3.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommonEntity\CommonEntity.csproj" />
|
||||
<ProjectReference Include="..\CommonTools\CommonTools.csproj" />
|
||||
<ProjectReference Include="..\guolv\guolv.fsproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
6
ConsoleApp2/ConsoleApp2.csproj.user
Normal file
6
ConsoleApp2/ConsoleApp2.csproj.user
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_LastSelectedProfileId>E:\tian\BLS\BLWLogServer\ConsoleApp2\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
655
ConsoleApp2/EnergyConsumption.cs
Normal file
655
ConsoleApp2/EnergyConsumption.cs
Normal file
@@ -0,0 +1,655 @@
|
||||
// <auto-generated>
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: EnergyConsumption.proto
|
||||
// </auto-generated>
|
||||
#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 {
|
||||
|
||||
/// <summary>Holder for reflection information generated from EnergyConsumption.proto</summary>
|
||||
public static partial class EnergyConsumptionReflection {
|
||||
|
||||
#region Descriptor
|
||||
/// <summary>File descriptor for EnergyConsumption.proto</summary>
|
||||
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
|
||||
/// <summary>
|
||||
/// 定义一个Person消息类型
|
||||
/// </summary>
|
||||
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
|
||||
public sealed partial class EnergyConsumption : pb::IMessage<EnergyConsumption>
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
, pb::IBufferMessage
|
||||
#endif
|
||||
{
|
||||
private static readonly pb::MessageParser<EnergyConsumption> _parser = new pb::MessageParser<EnergyConsumption>(() => new EnergyConsumption());
|
||||
private pb::UnknownFieldSet _unknownFields;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pb::MessageParser<EnergyConsumption> 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);
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "HotelCode" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "HostNumber" field.</summary>
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "Mac" field.</summary>
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "EndPoint" field.</summary>
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "Version" field.</summary>
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "IsTakeCard" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "V" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "A" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "P" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "KW_H" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "Sum_KW_H" field.</summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "CreateTime" field.</summary>
|
||||
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
|
||||
19
ConsoleApp2/EnergyConsumption.proto
Normal file
19
ConsoleApp2/EnergyConsumption.proto
Normal file
@@ -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;
|
||||
}
|
||||
120
ConsoleApp2/Program.cs
Normal file
120
ConsoleApp2/Program.cs
Normal file
@@ -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<NengHao>(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<UDPPackage>(nnn);
|
||||
AAA a = new AAA();
|
||||
MyClass mm = new MyClass();
|
||||
mm.Age = 30;
|
||||
mm.FirstName = "Test";
|
||||
mm.LastName = "我是一从此非常大霏霏 的数据";
|
||||
a.MyClass = new List<MyClass> { 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<string>(qf);
|
||||
AAA uuu111 = MyMessagePacker.FastDeserialize<AAA>(qf);
|
||||
//Console.WriteLine(uuu.MyClass.FirstOrDefault().FirstName);
|
||||
|
||||
FSharpList<byte> b = ListModule.OfArray(new byte[] { 0x01, 0x02, 0x03 });
|
||||
FSharpList<byte> 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> MyClass { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
18
ConsoleApp2/Properties/PublishProfiles/FolderProfile.pubxml
Normal file
18
ConsoleApp2/Properties/PublishProfiles/FolderProfile.pubxml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\Release\net8.0\publish\win-x64\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<PublishReadyToRun>false</PublishReadyToRun>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>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||;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
29
DAL/DAL.csproj
Normal file
29
DAL/DAL.csproj
Normal file
@@ -0,0 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Models\**" />
|
||||
<EmbeddedResource Remove="Models\**" />
|
||||
<None Remove="Models\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.19" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.19" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.19" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.19">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="New_Models\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
27
DAL/New_Models/DevMonitorLog.cs
Normal file
27
DAL/New_Models/DevMonitorLog.cs
Normal file
@@ -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; }
|
||||
}
|
||||
21
DAL/New_Models/EcoDetail.cs
Normal file
21
DAL/New_Models/EcoDetail.cs
Normal file
@@ -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; }
|
||||
}
|
||||
27
DAL/New_Models/EcoSetting.cs
Normal file
27
DAL/New_Models/EcoSetting.cs
Normal file
@@ -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; }
|
||||
}
|
||||
29
DAL/New_Models/KongTiaoTimer.cs
Normal file
29
DAL/New_Models/KongTiaoTimer.cs
Normal file
@@ -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; }
|
||||
}
|
||||
31
DAL/New_Models/LieEco.cs
Normal file
31
DAL/New_Models/LieEco.cs
Normal file
@@ -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; }
|
||||
}
|
||||
17
DAL/New_Models/RegisterLog.cs
Normal file
17
DAL/New_Models/RegisterLog.cs
Normal file
@@ -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; }
|
||||
}
|
||||
2477
DAL/New_Models/RicsContext.cs
Normal file
2477
DAL/New_Models/RicsContext.cs
Normal file
File diff suppressed because it is too large
Load Diff
13
DAL/New_Models/RoomNoBodyHowToLog.cs
Normal file
13
DAL/New_Models/RoomNoBodyHowToLog.cs
Normal file
@@ -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; }
|
||||
}
|
||||
19
DAL/New_Models/RoomNobodyHowTo.cs
Normal file
19
DAL/New_Models/RoomNobodyHowTo.cs
Normal file
@@ -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; }
|
||||
}
|
||||
25
DAL/New_Models/SmartRobotDisableTime.cs
Normal file
25
DAL/New_Models/SmartRobotDisableTime.cs
Normal file
@@ -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; }
|
||||
}
|
||||
35
DAL/New_Models/TbAlarmSetting.cs
Normal file
35
DAL/New_Models/TbAlarmSetting.cs
Normal file
@@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// 声音提示
|
||||
/// </summary>
|
||||
public bool? Beep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否移动端上应用
|
||||
/// </summary>
|
||||
public bool? AppApply { get; set; }
|
||||
}
|
||||
17
DAL/New_Models/TbAppHotel.cs
Normal file
17
DAL/New_Models/TbAppHotel.cs
Normal file
@@ -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; }
|
||||
}
|
||||
38
DAL/New_Models/TbAppMenu.cs
Normal file
38
DAL/New_Models/TbAppMenu.cs
Normal file
@@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联菜单ID
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 启用
|
||||
/// </summary>
|
||||
public bool ActiveIndicator { get; set; }
|
||||
}
|
||||
21
DAL/New_Models/TbAppRoom.cs
Normal file
21
DAL/New_Models/TbAppRoom.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DAL.New_Models;
|
||||
|
||||
public partial class TbAppRoom
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// app mac地址
|
||||
/// </summary>
|
||||
public string? Mac { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房号
|
||||
/// </summary>
|
||||
public string? RoomNumber { get; set; }
|
||||
|
||||
public int? HotelId { get; set; }
|
||||
}
|
||||
17
DAL/New_Models/TbCarbonStatus.cs
Normal file
17
DAL/New_Models/TbCarbonStatus.cs
Normal file
@@ -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; }
|
||||
}
|
||||
86
DAL/New_Models/TbFaultRecord.cs
Normal file
86
DAL/New_Models/TbFaultRecord.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DAL.New_Models;
|
||||
|
||||
public partial class TbFaultRecord
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维修状态:0未维修,1已维修
|
||||
/// </summary>
|
||||
public int? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 注销:1已注销
|
||||
/// </summary>
|
||||
public bool? IsCancel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 故障编号
|
||||
/// </summary>
|
||||
public string? Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房号
|
||||
/// </summary>
|
||||
public string? RoomNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 故障类别ID
|
||||
/// </summary>
|
||||
public int? FaultTypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 故障发生时间
|
||||
/// </summary>
|
||||
public DateTime? FaultTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 故障描述
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登记人
|
||||
/// </summary>
|
||||
public string? RegisteredPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登记时间
|
||||
/// </summary>
|
||||
public DateTime? RegisteredTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维修人
|
||||
/// </summary>
|
||||
public string? RepairPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维修时间
|
||||
/// </summary>
|
||||
public DateTime? RepairTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维修内容
|
||||
/// </summary>
|
||||
public string? RepairContent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 注销人
|
||||
/// </summary>
|
||||
public string? CancelPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 注销时间
|
||||
/// </summary>
|
||||
public DateTime? CancelTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 注销原因
|
||||
/// </summary>
|
||||
public string? CancelReason { get; set; }
|
||||
|
||||
public int? HotelId { get; set; }
|
||||
}
|
||||
26
DAL/New_Models/TbFaultType.cs
Normal file
26
DAL/New_Models/TbFaultType.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DAL.New_Models;
|
||||
|
||||
public partial class TbFaultType
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 故障编号
|
||||
/// </summary>
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 故障名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 故障说明
|
||||
/// </summary>
|
||||
public string? Remark { get; set; }
|
||||
|
||||
public int? HotelId { get; set; }
|
||||
}
|
||||
19
DAL/New_Models/TbGroup.cs
Normal file
19
DAL/New_Models/TbGroup.cs
Normal file
@@ -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<TbHost> TbHosts { get; set; } = new List<TbHost>();
|
||||
}
|
||||
200
DAL/New_Models/TbHost.cs
Normal file
200
DAL/New_Models/TbHost.cs
Normal file
@@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// 主机编号
|
||||
/// </summary>
|
||||
public string? HostNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房间号
|
||||
/// </summary>
|
||||
public string? RoomNumber { get; set; }
|
||||
|
||||
public string? Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子网掩码
|
||||
/// </summary>
|
||||
public string? SubnetMask { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认网关
|
||||
/// </summary>
|
||||
public string? Gateway { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 端口
|
||||
/// </summary>
|
||||
public int? Port { get; set; }
|
||||
|
||||
public string? Mac { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属楼层
|
||||
/// </summary>
|
||||
public int? GroupId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房型
|
||||
/// </summary>
|
||||
public int? RoomTypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态 0:离线 1:在线
|
||||
/// </summary>
|
||||
public bool? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
/// </summary>
|
||||
public string? Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 注册日期
|
||||
/// </summary>
|
||||
public DateTime? RegisterDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房态
|
||||
/// </summary>
|
||||
public int? RoomStatusId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份
|
||||
/// </summary>
|
||||
public int? RoomCardId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 门锁
|
||||
/// </summary>
|
||||
public bool? DoorLockStatus { get; set; }
|
||||
|
||||
public DateTime? DoorLockStatusUpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保险箱:0关,1开,2未接保险箱
|
||||
/// </summary>
|
||||
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<TbHostUpdateStatus> TbHostUpdateStatuses { get; set; } = new List<TbHostUpdateStatus>();
|
||||
|
||||
public virtual ICollection<TbRoomService> TbRoomServices { get; set; } = new List<TbRoomService>();
|
||||
}
|
||||
214
DAL/New_Models/TbHostAir.cs
Normal file
214
DAL/New_Models/TbHostAir.cs
Normal file
@@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// 空调运行状态,0/停止,1/运行
|
||||
/// </summary>
|
||||
public bool? Running { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前温度
|
||||
/// </summary>
|
||||
public short? CurrentTemp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设定温度
|
||||
/// </summary>
|
||||
public short? SettingTemp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 风速:0/停止, 1/低速, 2/中速, 3/高速, 4/自动
|
||||
/// </summary>
|
||||
public short? Speed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 冷阀门:0关,1开
|
||||
/// </summary>
|
||||
public short? ColdValve { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 热阀门:0关,1开
|
||||
/// </summary>
|
||||
public short? ThermalValve { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保温温度
|
||||
/// </summary>
|
||||
public short? KeepTemp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始温度
|
||||
/// </summary>
|
||||
public short? InitTemp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最高温度
|
||||
/// </summary>
|
||||
public short? HightTemp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最低温度
|
||||
/// </summary>
|
||||
public short? LowerTemp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 死区温度
|
||||
/// </summary>
|
||||
public short? DeadTemp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 热
|
||||
/// </summary>
|
||||
public short? HotDevition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 冷偏差
|
||||
/// </summary>
|
||||
public short? ColdDevition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 欢迎模式时间(分钟)
|
||||
/// </summary>
|
||||
public short? WelcomeTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否锁定温度
|
||||
/// </summary>
|
||||
public bool? IsLockTemp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 锁定温度
|
||||
/// </summary>
|
||||
public short? LockTemp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模式: 1/制冷模式,2/制热模式,4/送风模式,8/除湿模式
|
||||
/// </summary>
|
||||
public int? Mode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 阀状态: 0/冷阀开,1/冷阀关,2/热阀开,3/热阀关
|
||||
/// </summary>
|
||||
public int? Valve { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 空调管制:0/二管制,1/四管制
|
||||
/// </summary>
|
||||
public int? ControlType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 补偿温度
|
||||
/// </summary>
|
||||
public double? CompensatoryTemp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否关联房态
|
||||
/// </summary>
|
||||
public bool? RelateRoomStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否关联门磁
|
||||
/// </summary>
|
||||
public bool? RelateDoorContact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 冷热模式:0/手动,1/自动
|
||||
/// </summary>
|
||||
public int? ColdHotMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 冷热转换延时,单位:秒
|
||||
/// </summary>
|
||||
public int? ColdHotSwitchDelayTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 温度到达停止风机运行
|
||||
/// </summary>
|
||||
public bool? FanStop { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 禁止风机高速运行:0/否,1/是
|
||||
/// </summary>
|
||||
public bool? DisableFanHighSpeed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 启用睡眠标志
|
||||
/// </summary>
|
||||
public bool? SleepFlag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 睡眠开始时间
|
||||
/// </summary>
|
||||
public string? SleepStartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 睡眠结束时间
|
||||
/// </summary>
|
||||
public string? SleepEndTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 睡眠模式偏差
|
||||
/// </summary>
|
||||
public short? SleepDevition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 睡眠热
|
||||
/// </summary>
|
||||
public short? SleepHotDevition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 睡眠冷偏差
|
||||
/// </summary>
|
||||
public short? SleepColdDevition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 启动定时
|
||||
/// </summary>
|
||||
public bool? TimeFlag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 定时开始时间1
|
||||
/// </summary>
|
||||
public string? TimeStartTime1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 定时结束时间1
|
||||
/// </summary>
|
||||
public string? TimeEndTime1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 定时开始时间2
|
||||
/// </summary>
|
||||
public string? TimeStartTime2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 定时结束时间2
|
||||
/// </summary>
|
||||
public string? TimeEndTime2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 定时开始时间3
|
||||
/// </summary>
|
||||
public string? TimeStartTime3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 定时结束时间3
|
||||
/// </summary>
|
||||
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!;
|
||||
}
|
||||
47
DAL/New_Models/TbHostAirRecord.cs
Normal file
47
DAL/New_Models/TbHostAirRecord.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DAL.New_Models;
|
||||
|
||||
public partial class TbHostAirRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主机ID
|
||||
/// </summary>
|
||||
public int HostId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房号
|
||||
/// </summary>
|
||||
public string RoomNumber { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 空调序号
|
||||
/// </summary>
|
||||
public int AirNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 温度类型
|
||||
/// </summary>
|
||||
public int TempType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 温度值
|
||||
/// </summary>
|
||||
public int Temp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
/// </summary>
|
||||
public DateTime StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束时间
|
||||
/// </summary>
|
||||
public DateTime? EndTime { get; set; }
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user