From 0ddf1a66f3b9bce110f800b0fad391f214e6364d Mon Sep 17 00:00:00 2001
From: fajiao <1519100073@qq.com>
Date: Wed, 28 Dec 2022 08:54:32 +0800
Subject: [PATCH] feat: CbCameraNode
---
Cis.Application/Cb/Common/CbInfo.cs | 15 +++++
Cis.Application/Cb/Entity/CbCameraNode.cs | 40 +++++++++++++
.../Cb/Service/CbCameraNodeService.cs | 34 +++++++++++
Cis.Application/Cis.Application.xml | 57 +++++++++++++++++++
Cis.Core/Cis.Core.csproj | 2 +-
Cis.Web.Core/Startup.cs | 2 +-
Cis.Web.Entry/Program.cs | 34 +++++------
7 files changed, 161 insertions(+), 23 deletions(-)
create mode 100644 Cis.Application/Cb/Entity/CbCameraNode.cs
create mode 100644 Cis.Application/Cb/Service/CbCameraNodeService.cs
diff --git a/Cis.Application/Cb/Common/CbInfo.cs b/Cis.Application/Cb/Common/CbInfo.cs
index 612cbc7..e4f743c 100644
--- a/Cis.Application/Cb/Common/CbInfo.cs
+++ b/Cis.Application/Cb/Common/CbInfo.cs
@@ -12,6 +12,11 @@ public class CbInfo
///
public const string GroupName = "CameraBase";
+ ///
+ /// CbCameraNode Api 分组排序
+ ///
+ public const int CbCameraNodeGroupOrder = 100;
+
///
/// CbCamera Api 分组排序
///
@@ -35,6 +40,16 @@ public class CbInfo
#region Table Info
+ ///
+ /// CbCameraNode 表名
+ ///
+ public const string CbCameraNodeTbName = "cb_camera_node";
+
+ ///
+ /// CbCameraNode 表描述
+ ///
+ public const string CbCameraNodeTbDesc = "相机节点表";
+
///
/// CbCamera 表名
///
diff --git a/Cis.Application/Cb/Entity/CbCameraNode.cs b/Cis.Application/Cb/Entity/CbCameraNode.cs
new file mode 100644
index 0000000..666b8f7
--- /dev/null
+++ b/Cis.Application/Cb/Entity/CbCameraNode.cs
@@ -0,0 +1,40 @@
+namespace Cis.Application.Cb;
+
+///
+/// 相机节点表
+///
+[SugarTable(CbInfo.CbCameraNodeTbName, CbInfo.CbCameraNodeTbDesc)]
+[Tenant(CbInfo.DbName)]
+public class CbCameraNode : EntityBase
+{
+ ///
+ /// 组标识
+ ///
+ [SugarColumn(ColumnDescription = "组标识")]
+ public bool IsGroup { get; set; }
+
+ ///
+ /// 名称
+ ///
+ [SugarColumn(ColumnDescription = "名称", Length = 64)]
+ [Required, MaxLength(64)]
+ public string Name { get; set; }
+
+ ///
+ /// 相机 Id
+ ///
+ [SugarColumn(ColumnDescription = "相机Id")]
+ public long CbCameraId { get; set; }
+
+ ///
+ /// 父节点 Id
+ ///
+ [SugarColumn(ColumnDescription = "父节点Id")]
+ public long ParentId { get; set; }
+
+ ///
+ /// 子节点列表
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public List Child { get; set; }
+}
\ No newline at end of file
diff --git a/Cis.Application/Cb/Service/CbCameraNodeService.cs b/Cis.Application/Cb/Service/CbCameraNodeService.cs
new file mode 100644
index 0000000..27c242b
--- /dev/null
+++ b/Cis.Application/Cb/Service/CbCameraNodeService.cs
@@ -0,0 +1,34 @@
+using Cis.Core.Common;
+using Newtonsoft.Json.Linq;
+
+namespace Cis.Application.Cb;
+
+///
+/// 相机节点服务
+///
+[ApiDescriptionSettings(CbInfo.GroupName, Order = CbInfo.CbCameraNodeGroupOrder)]
+public class CbCameraNodeService : ServiceBase, ITransient
+{
+ public CbCameraNodeService(SqlSugarRepository baseRep) : base(baseRep)
+ {
+ }
+
+ ///
+ /// 获取树
+ ///
+ /// equal:ParentId(default:0);
+ ///
+ [HttpGet]
+ public virtual async Task> GetTree(string queryJson = "")
+ {
+ JObject queryObj = queryJson.ToJObject();
+ queryObj.TryAdd("ParentId", 0);
+
+ long parentId = (long)queryObj.GetValue("ParentId");
+
+ var tree = await _baseRep.AsQueryable()
+ .OrderBy(it => it.CreateTime)
+ .ToTreeAsync(it => it.Child, it => it.ParentId, parentId);
+ return tree;
+ }
+}
\ No newline at end of file
diff --git a/Cis.Application/Cis.Application.xml b/Cis.Application/Cis.Application.xml
index 8d6cc96..51a88ed 100644
--- a/Cis.Application/Cis.Application.xml
+++ b/Cis.Application/Cis.Application.xml
@@ -14,6 +14,11 @@
Api 分组名
+
+
+ CbCameraNode Api 分组排序
+
+
CbCamera Api 分组排序
@@ -29,6 +34,16 @@
数据库标识
+
+
+ CbCameraNode 表名
+
+
+
+
+ CbCameraNode 表描述
+
+
CbCamera 表名
@@ -99,6 +114,36 @@
相机参数 Id
+
+
+ 相机节点表
+
+
+
+
+ 组标识
+
+
+
+
+ 名称
+
+
+
+
+ 相机 Id
+
+
+
+
+ 父节点 Id
+
+
+
+
+ 子节点列表
+
+
相机参数表
@@ -139,6 +184,18 @@
zoom变化函数
+
+
+ 相机节点服务
+
+
+
+
+ 获取树
+
+ equal:ParentId(default:0);
+
+
相机参数服务
diff --git a/Cis.Core/Cis.Core.csproj b/Cis.Core/Cis.Core.csproj
index 0a2984b..27d689b 100644
--- a/Cis.Core/Cis.Core.csproj
+++ b/Cis.Core/Cis.Core.csproj
@@ -34,6 +34,6 @@
-
+
diff --git a/Cis.Web.Core/Startup.cs b/Cis.Web.Core/Startup.cs
index 0e80bf0..03daf40 100644
--- a/Cis.Web.Core/Startup.cs
+++ b/Cis.Web.Core/Startup.cs
@@ -66,7 +66,7 @@ public class Startup : AppStartup
// 日志记录
if (App.GetConfig("Logging:File:Enabled")) // 日志写入文件
{
- Array.ForEach(new[] { LogLevel.Information, LogLevel.Warning, LogLevel.Error }, logLevel =>
+ Array.ForEach(new[] { LogLevel.Information, LogLevel.Warning, LogLevel.Error, LogLevel.Critical }, logLevel =>
{
services.AddFileLogging(options =>
{
diff --git a/Cis.Web.Entry/Program.cs b/Cis.Web.Entry/Program.cs
index e0edba2..09162be 100644
--- a/Cis.Web.Entry/Program.cs
+++ b/Cis.Web.Entry/Program.cs
@@ -1,23 +1,15 @@
-using Furion.Logging;
-
-// δ쳣
-AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
// webServer
-Serve.Run(RunOptions.Default.AddWebComponent().WithArgs(args));
-
-void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
-{
- Log.Error(sender?.ToString(), e);
-}
+Serve.Run(RunOptions.Default.WithArgs(args));
-public class WebComponent : IWebComponent
-{
- public void Load(WebApplicationBuilder builder, ComponentContext componentContext)
- {
- // ־
- builder.Logging.AddFilter((provider, category, logLevel) =>
- {
- return !new[] { "Microsoft.Hosting", "Microsoft.AspNetCore" }.Any(u => category.StartsWith(u)) && logLevel >= LogLevel.Information;
- });
- }
-}
\ No newline at end of file
+//Serve.Run(RunOptions.Default.AddWebComponent().WithArgs(args));
+//public class WebComponent : IWebComponent
+//{
+// public void Load(WebApplicationBuilder builder, ComponentContext componentContext)
+// {
+// // ־
+// builder.Logging.AddFilter((provider, category, logLevel) =>
+// {
+// return !new[] { "Microsoft.Hosting", "Microsoft.AspNetCore" }.Any(u => category.StartsWith(u)) && logLevel >= LogLevel.Information;
+// });
+// }
+//}
\ No newline at end of file