diff --git a/Cis.Application/Cb/Entity/CbCamera.cs b/Cis.Application/Cb/Entity/CbCamera.cs
index 9776a10..aa6e005 100644
--- a/Cis.Application/Cb/Entity/CbCamera.cs
+++ b/Cis.Application/Cb/Entity/CbCamera.cs
@@ -1,4 +1,6 @@
-namespace Cis.Application.Cb;
+using Furion.DataValidation;
+
+namespace Cis.Application.Cb;
///
/// 相机表
@@ -19,6 +21,7 @@ public class CbCamera : EntityBase
///
[SugarColumn(ColumnDescription = "ip地址", Length = 16)]
[Required, MaxLength(16)]
+ [DataValidation(ValidationTypes.IPv4)]
public string Ip { get; set; }
///
diff --git a/Cis.Application/Cis.Application.xml b/Cis.Application/Cis.Application.xml
index aaa8694..8b02e6a 100644
--- a/Cis.Application/Cis.Application.xml
+++ b/Cis.Application/Cis.Application.xml
@@ -669,6 +669,16 @@
+
+
+ 将计算公式存储到数据库,实现动态计算公式
+ https://github.com/houlongchao/HLC.Expression
+ https://blog.csdn.net/cxb2011/article/details/100837168
+ https://github.com/zz1231118/Rabbit
+
+
+
+
更新相机计算参数
@@ -759,11 +769,6 @@
字典类型Id
-
-
- 字典类型
-
-
值
diff --git a/Cis.Application/Cm/Entity/CmMarkGroup.cs b/Cis.Application/Cm/Entity/CmMarkGroup.cs
index 843f56d..07989b7 100644
--- a/Cis.Application/Cm/Entity/CmMarkGroup.cs
+++ b/Cis.Application/Cm/Entity/CmMarkGroup.cs
@@ -11,12 +11,14 @@ public class CmMarkGroup : EntityBase
/// 名称
///
[SugarColumn(ColumnDescription = "名称", Length = 64)]
+ [Required]
public string Name { get; set; }
///
/// 排序
///
[SugarColumn(ColumnDescription = "排序")]
+ [Required]
public int Order { get; set; }
///
diff --git a/Cis.Application/Cm/Entity/CmMarkLabel.cs b/Cis.Application/Cm/Entity/CmMarkLabel.cs
index 5dc870d..609b514 100644
--- a/Cis.Application/Cm/Entity/CmMarkLabel.cs
+++ b/Cis.Application/Cm/Entity/CmMarkLabel.cs
@@ -11,6 +11,7 @@ public class CmMarkLabel : EntityBase
/// 相机 Id
///
[SugarColumn(ColumnDescription = "相机Id")]
+ [Required]
public long CbCameraId { get; set; }
///
@@ -23,6 +24,7 @@ public class CmMarkLabel : EntityBase
/// 名称
///
[SugarColumn(ColumnDescription = "名称", Length = 64)]
+ [Required]
public string Name { get; set; }
///
@@ -47,24 +49,28 @@ public class CmMarkLabel : EntityBase
/// 视频宽度
///
[SugarColumn(ColumnDescription = "视频宽度")]
+ [Required]
public double VideoWidth { get; set; }
///
/// 视频高度
///
[SugarColumn(ColumnDescription = "视频高度")]
+ [Required]
public double VideoHeight { get; set; }
///
/// 画布 left 距离比例
///
[SugarColumn(ColumnDescription = "画布 left 距离比例")]
+ [Required]
public double CanvasLeftRatio { get; set; }
///
/// 画布 top 距离比例
///
[SugarColumn(ColumnDescription = "画布 top 距离比例")]
+ [Required]
public double CanvasTopRatio { get; set; }
///
diff --git a/Cis.Application/Core/Center/CameraDataCenter.cs b/Cis.Application/Core/Center/CameraDataCenter.cs
index ab46d0f..0c6d78b 100644
--- a/Cis.Application/Core/Center/CameraDataCenter.cs
+++ b/Cis.Application/Core/Center/CameraDataCenter.cs
@@ -1,6 +1,4 @@
-using Cis.Application.Cb;
-using Cis.Application.Cm;
-using Cis.Application.Core.Component.MarkSeacher;
+using Cis.Application.Core.Component.MarkSeacher;
using Cis.Application.Core.Component.PtzServer;
using EC.Helper.CameraSDK;
using StackExchange.Profiling.Internal;
@@ -13,10 +11,7 @@ public class CameraDataCenter : ISingleton
{
#region Attr
- private readonly SqlSugarRepository _cbCameraRep;
- private readonly SqlSugarRepository _cmMarkLableRep;
private readonly IDatabase _cache;
-
private readonly CameraDataOptions _options;
private readonly ICameraSdkServer _cameraSdkServer;
private readonly IMarkSearcherServer _markSearcherServer;
@@ -35,8 +30,6 @@ public class CameraDataCenter : ISingleton
IMarkSearcherServer markSearcherServer
)
{
- _cbCameraRep = App.GetService>();
- _cmMarkLableRep = App.GetService>();
_cache = cache;
_options = App.GetOptions();
_cameraSdkServer = cameraSdkServer;
diff --git a/Cis.Application/Core/Component/MarkSeacher/Seacher/MarkSearcherBase.cs b/Cis.Application/Core/Component/MarkSeacher/Seacher/MarkSearcherBase.cs
index dfd95e7..5ea5cee 100644
--- a/Cis.Application/Core/Component/MarkSeacher/Seacher/MarkSearcherBase.cs
+++ b/Cis.Application/Core/Component/MarkSeacher/Seacher/MarkSearcherBase.cs
@@ -147,29 +147,12 @@ public abstract class MarkSearcherBase
public List Search()
{
List resultList = new();
-
if (World2CameraMatrix == null || MarkLabelCalcParamsDict.IsEmpty)
return resultList;
foreach (MarkLabelCalcParams item in MarkLabelCalcParamsDict.Values)
{
- Matrix labelC2WMatrix = ConvertCameraToWorld(item);
- Matrix labelPointMatrix = new DenseMatrix(3, 1, new double[]
- {
- (item.CanvasLeftRatio-0.5)*item.VideoWidth / CameraCalcParams.VideoWidth,
- (item.CanvasTopRatio-0.5)*item.VideoHeight / CameraCalcParams.VideoHeight,
- 1
- });
- Matrix lResult = labelC2WMatrix.Multiply(labelPointMatrix);
- Matrix pResult = World2CameraMatrix.Multiply(lResult);
-
- double x = pResult[0, 0] / pResult[2, 0] + 0.5;
- double y = pResult[1, 0] / pResult[2, 0] + 0.5;
- MarkLabelCalcResult labelCalcResult;
- if (x > 0.99 || x < 0.01 || y > 0.99 || y < 0.01 || pResult[2, 0] < 0)
- labelCalcResult = MarkLabelCalcResult.New(item.Id, false);
- else
- labelCalcResult = MarkLabelCalcResult.New(item.Id, true, x, y);
+ MarkLabelCalcResult labelCalcResult = SearchMarkLabel(item);
resultList.Add(labelCalcResult);
}
return resultList;
@@ -177,7 +160,42 @@ public abstract class MarkSearcherBase
public async Task> SearchAsync()
{
- return await Task.Run(Search);
+ List resultList = new();
+ if (World2CameraMatrix == null || MarkLabelCalcParamsDict.IsEmpty)
+ return resultList;
+
+ List tasks = new();
+ foreach (MarkLabelCalcParams item in MarkLabelCalcParamsDict.Values)
+ {
+ tasks.Add(Task.Run(() =>
+ {
+ resultList.Add(SearchMarkLabel(item));
+ }));
+ }
+ await Task.WhenAll(tasks);
+ return resultList;
+ }
+
+ private MarkLabelCalcResult SearchMarkLabel(MarkLabelCalcParams item)
+ {
+ Matrix labelC2WMatrix = ConvertCameraToWorld(item);
+ Matrix labelPointMatrix = new DenseMatrix(3, 1, new double[]
+ {
+ (item.CanvasLeftRatio-0.5)*item.VideoWidth / CameraCalcParams.VideoWidth,
+ (item.CanvasTopRatio-0.5)*item.VideoHeight / CameraCalcParams.VideoHeight,
+ 1
+ });
+ Matrix lResult = labelC2WMatrix.Multiply(labelPointMatrix);
+ Matrix pResult = World2CameraMatrix.Multiply(lResult);
+
+ double x = pResult[0, 0] / pResult[2, 0] + 0.5;
+ double y = pResult[1, 0] / pResult[2, 0] + 0.5;
+ MarkLabelCalcResult labelCalcResult;
+ if (x > 0.99 || x < 0.01 || y > 0.99 || y < 0.01 || pResult[2, 0] < 0)
+ labelCalcResult = MarkLabelCalcResult.New(item.Id, false);
+ else
+ labelCalcResult = MarkLabelCalcResult.New(item.Id, true, x, y);
+ return labelCalcResult;
}
#endregion Calc
diff --git a/Cis.Application/Sys/Entity/SysDictData.cs b/Cis.Application/Sys/Entity/SysDictData.cs
index 744e2bf..ec34f14 100644
--- a/Cis.Application/Sys/Entity/SysDictData.cs
+++ b/Cis.Application/Sys/Entity/SysDictData.cs
@@ -4,21 +4,16 @@
/// 系统字典值表
///
[SugarTable("sys_dict_data", "系统字典值表")]
+[Tenant(SysInfo.DbName)]
public class SysDictData : EntityBase
{
///
/// 字典类型Id
///
[SugarColumn(ColumnDescription = "字典类型Id")]
+ [Required]
public long DictTypeId { get; set; }
- ///
- /// 字典类型
- ///
- [SugarColumn(IsIgnore = true)]
- [Navigate(NavigateType.OneToOne, nameof(DictTypeId))]
- public SysDictType DictType { get; set; }
-
///
/// 值
///
@@ -37,6 +32,7 @@ public class SysDictData : EntityBase
/// 排序
///
[SugarColumn(ColumnDescription = "排序")]
+ [Required]
public int Order { get; set; }
///
@@ -50,5 +46,6 @@ public class SysDictData : EntityBase
/// 状态
///
[SugarColumn(ColumnDescription = "状态")]
+ [Required]
public StatusEnum Status { get; set; } = StatusEnum.Enable;
}
\ No newline at end of file
diff --git a/Cis.Application/Sys/Entity/SysDictType.cs b/Cis.Application/Sys/Entity/SysDictType.cs
index 00e5173..fdd77f8 100644
--- a/Cis.Application/Sys/Entity/SysDictType.cs
+++ b/Cis.Application/Sys/Entity/SysDictType.cs
@@ -1,9 +1,12 @@
-namespace Cis.Application.Sys;
+using Cis.Application.Cm;
+
+namespace Cis.Application.Sys;
///
/// 系统字典类型表
///
[SugarTable(SysInfo.SysDictTypeTbName, SysInfo.SysDictTypeTbDesc)]
+[Tenant(SysInfo.DbName)]
public class SysDictType : EntityBase
{
///
@@ -24,6 +27,7 @@ public class SysDictType : EntityBase
/// 排序
///
[SugarColumn(ColumnDescription = "排序")]
+ [Required]
public int Order { get; set; }
///
@@ -37,5 +41,6 @@ public class SysDictType : EntityBase
/// 状态
///
[SugarColumn(ColumnDescription = "状态")]
+ [Required]
public StatusEnum Status { get; set; } = StatusEnum.Enable;
}
\ No newline at end of file
diff --git a/Cis.Application/Sys/SeedData/SysDictDataSeedData.cs b/Cis.Application/Sys/SeedData/SysDictDataSeedData.cs
new file mode 100644
index 0000000..81d4985
--- /dev/null
+++ b/Cis.Application/Sys/SeedData/SysDictDataSeedData.cs
@@ -0,0 +1,18 @@
+namespace Cis.Application.Sys.SeedData;
+
+public class SysDictDataSeedData : ISqlSugarEntitySeedData
+{
+ public IEnumerable HasData()
+ {
+ return new SysDictData[]
+ {
+ new(){Id=358769934100001, DictTypeId=358728043100001, Code="HiK", Value="1", Order=100, Remark="海康相机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
+ new(){Id=358769934100002, DictTypeId=358728043100001, Code="DaHua", Value="2", Order=100, Remark="大华相机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
+ new(){Id=358769934100003, DictTypeId=358728043100001, Code="YuShi", Value="3", Order=100, Remark="宇视相机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
+
+ new(){Id=358769934100011, DictTypeId=358728043100002, Code="HiK", Value="8000", Order=100, Remark="海康sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
+ new(){Id=358769934100012, DictTypeId=358728043100002, Code="DaHua", Value="37777", Order=100, Remark="大华sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
+ new(){Id=358769934100013, DictTypeId=358728043100002, Code="YuShi", Value="8800", Order=100, Remark="宇视sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
+ };
+ }
+}
\ No newline at end of file
diff --git a/Cis.Application/Sys/SeedData/SysDictTypeSeedData.cs b/Cis.Application/Sys/SeedData/SysDictTypeSeedData.cs
new file mode 100644
index 0000000..387e590
--- /dev/null
+++ b/Cis.Application/Sys/SeedData/SysDictTypeSeedData.cs
@@ -0,0 +1,13 @@
+namespace Cis.Application.Sys.SeedData;
+
+public class SysDictTypeSeedData : ISqlSugarEntitySeedData
+{
+ public IEnumerable HasData()
+ {
+ return new SysDictType[]
+ {
+ new(){ Id=358728043100001, Name="相机类型", Code="camera_type", Order=100, Remark="相机类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
+ new(){ Id=358728043100002, Name="相机SDK端口", Code="camera_sdk_port", Order=100, Remark="相机SDK端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
+ };
+ }
+}
\ No newline at end of file
diff --git a/Cis.Core/Cis.Core.xml b/Cis.Core/Cis.Core.xml
index 6a27031..c891a44 100644
--- a/Cis.Core/Cis.Core.xml
+++ b/Cis.Core/Cis.Core.xml
@@ -194,21 +194,6 @@
时间戳
-
-
- 缓存类型枚举
-
-
-
-
- 内存缓存
-
-
-
-
- Redis缓存
-
-
通用状态枚举
diff --git a/Cis.Core/Common/Enum/CacheTypeEnum.cs b/Cis.Core/Common/Enum/CacheTypeEnum.cs
deleted file mode 100644
index 0848f8a..0000000
--- a/Cis.Core/Common/Enum/CacheTypeEnum.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-namespace Cis.Core;
-
-///
-/// 缓存类型枚举
-///
-public enum CacheTypeEnum
-{
- ///
- /// 内存缓存
- ///
- [Description("内存缓存")]
- Memory,
-
- ///
- /// Redis缓存
- ///
- [Description("Redis缓存")]
- Redis
-}
\ No newline at end of file