Browse Source

feat: 版本更新,添加 CameraType 字段,调整服务注册方式

master
fajiao 2 years ago
parent
commit
307240c4ac
  1. 27
      Cis.Application/Cb/Entity/BO/CbCameraBO.cs
  2. 13
      Cis.Application/Cb/Entity/CbCameraParams.cs
  3. 28
      Cis.Application/Cb/Service/CbCameraParamsService.cs
  4. 69
      Cis.Application/Cb/Service/CbCameraService.cs
  5. 8
      Cis.Application/Cis.Application.csproj
  6. 75
      Cis.Application/Cis.Application.xml
  7. 4
      Cis.Application/Cm/Service/CmMarkGroupService.cs
  8. 10
      Cis.Application/Cm/Service/CmMarkLabelService.cs
  9. 12
      Cis.Application/Core/Center/CameraDataCenter.cs
  10. 16
      Cis.Application/Core/Center/InstanceCenter.cs
  11. 20
      Cis.Application/Core/Common/Extension.cs
  12. 2
      Cis.Application/Core/Component/CameraSDK/CameraSdkServer.cs
  13. 4
      Cis.Application/Core/Component/MarkSeacher/MarkSearcherServer.cs
  14. 2
      Cis.Application/Core/Component/Onvif/OnvifServer.cs
  15. 3
      Cis.Application/Core/Service/MarkSearchService.cs
  16. 3
      Cis.Application/Core/Service/OnvifService.cs
  17. 1
      Cis.Application/Startup.cs
  18. 10
      Cis.Application/Sys/SeedData/SysDictDataSeedData.cs
  19. 3
      Cis.Application/Sys/SeedData/SysDictTypeSeedData.cs
  20. 2
      Cis.Application/Sys/Service/SysDictDataService.cs
  21. 4
      Cis.Application/Sys/Service/SysDictTypeService.cs
  22. 5
      Cis.Core/Cache/CacheSetup.cs
  23. 2
      Cis.Core/Cis.Core.csproj
  24. 28
      Cis.Core/Cis.Core.xml
  25. 21
      Cis.Core/Common/Entity/ServiceBase.cs
  26. 17
      Cis.Core/Common/Extension/ObjectExtension.cs
  27. 4
      Cis.Core/CoreConfig.json
  28. 2
      Cis.Web.Entry/Program.cs
  29. 5
      Cis.sln
  30. 12
      EC.Helper/CameraSDK/Common/CameraException.cs
  31. 28
      EC.Helper/CameraSDK/Common/CameraStruct.cs
  32. 2
      EC.Helper/CameraSDK/DaHua/DaHuaSDK.cs
  33. 2
      EC.Helper/CameraSDK/HiK/HiKSDK.cs
  34. 2
      EC.Helper/CameraSDK/YuShi/YuShiSDK.cs
  35. 4
      EC.Helper/Onvif/OnvifClient.cs
  36. 4
      Frontend/src/api/cameraMark/markSearchApi.ts

27
Cis.Application/Cb/Entity/BO/CbCameraBO.cs

@ -0,0 +1,27 @@
namespace Cis.Application.Cb;
/// <summary>
/// 相机 BO
/// </summary>
public class CbCameraBO
{
/// <summary>
/// cbCameraId
/// </summary>
public long Id { get; set; }
/// <summary>
/// cbCamera 实体类
/// </summary>
public CbCamera CbCamera { get; set; }
/// <summary>
/// cbCameraParams 实体类
/// </summary>
public CbCameraParams CbCameraParams { get; set; }
public static CbCameraBO New(long cbCameraId, CbCamera cbCamera, CbCameraParams cbCameraParams)
{
return new() { Id = cbCameraId, CbCamera = cbCamera, CbCameraParams = cbCameraParams };
}
}

13
Cis.Application/Cb/Entity/CbCameraParams.cs

@ -15,11 +15,11 @@ public class CbCameraParams : EntityBase
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// 相机类型 /// 相机厂商
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "相机类型")] [SugarColumn(ColumnDescription = "相机厂商")]
[Required] [Required]
public int CameraType { get; set; } public int Manufactor { get; set; }
/// <summary> /// <summary>
/// sdk 端口 /// sdk 端口
@ -28,6 +28,13 @@ public class CbCameraParams : EntityBase
[Required] [Required]
public int SdkPort { get; set; } public int SdkPort { get; set; }
/// <summary>
/// 相机类型
/// </summary>
[SugarColumn(ColumnDescription = "相机类型")]
[Required]
public int Type { get; set; }
/// <summary> /// <summary>
/// FocusX /// FocusX
/// </summary> /// </summary>

28
Cis.Application/Cb/Service/CbCameraParamsService.cs

@ -16,18 +16,20 @@ public class CbCameraParamsService : ServiceBase<CbCameraParams>, ITransient
/// <summary> /// <summary>
/// 获取实体类 /// 获取实体类
/// </summary> /// </summary>
/// <param name="queryJson">equal:cameraType,id,isDelete; like:name; between:[startTime,endTime];</param> /// <param name="queryJson">equal:manufactor,type,id,isDelete; like:name; between:[startTime,endTime];</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public override async Task<CbCameraParams> GetQ([Required] string queryJson) public override async Task<CbCameraParams> GetByQ([Required] string queryJson)
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();
var exp = Expressionable.Create<CbCameraParams>(); var exp = Expressionable.Create<CbCameraParams>();
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name)) if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
exp.And(it => it.Name.Contains(name.ToString())); exp.And(it => it.Name.Contains(name.ToString()));
if (queryObj.TryGetValue("cameraType", StringComparison.OrdinalIgnoreCase, out JToken cameraType)) if (queryObj.TryGetValue("manufactor", StringComparison.OrdinalIgnoreCase, out JToken manufactor))
exp.And(it => it.CameraType.Equals(cameraType)); exp.And(it => it.Manufactor.Equals(manufactor));
if (queryObj.TryGetValue("type", StringComparison.OrdinalIgnoreCase, out JToken type))
exp.And(it => it.Type.Equals(type));
if (queryObj.TryGetValue("Id", StringComparison.OrdinalIgnoreCase, out JToken Id)) if (queryObj.TryGetValue("Id", StringComparison.OrdinalIgnoreCase, out JToken Id))
exp.And(it => it.Id.Equals(Id)); exp.And(it => it.Id.Equals(Id));
if (queryObj.TryGetValue("IsDelete", StringComparison.OrdinalIgnoreCase, out JToken isDelete)) if (queryObj.TryGetValue("IsDelete", StringComparison.OrdinalIgnoreCase, out JToken isDelete))
@ -45,7 +47,7 @@ public class CbCameraParamsService : ServiceBase<CbCameraParams>, ITransient
/// <summary> /// <summary>
/// 批量获取实体类 /// 批量获取实体类
/// </summary> /// </summary>
/// <param name="queryJson">equal:cameraType,isDelete; like:name; between:[startTime,endTime];</param> /// <param name="queryJson">equal:manufactor,type,isDelete; like:name; between:[startTime,endTime];</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public override async Task<List<CbCameraParams>> GetList(string queryJson = "") public override async Task<List<CbCameraParams>> GetList(string queryJson = "")
@ -55,8 +57,10 @@ public class CbCameraParamsService : ServiceBase<CbCameraParams>, ITransient
var exp = Expressionable.Create<CbCameraParams>(); var exp = Expressionable.Create<CbCameraParams>();
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name)) if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
exp.And(it => it.Name.Contains(name.ToString())); exp.And(it => it.Name.Contains(name.ToString()));
if (queryObj.TryGetValue("cameraType", StringComparison.OrdinalIgnoreCase, out JToken cameraType)) if (queryObj.TryGetValue("manufactor", StringComparison.OrdinalIgnoreCase, out JToken manufactor))
exp.And(it => it.CameraType.Equals(cameraType)); exp.And(it => it.Manufactor.Equals(manufactor));
if (queryObj.TryGetValue("type", StringComparison.OrdinalIgnoreCase, out JToken type))
exp.And(it => it.Type.Equals(type));
if (queryObj.TryGetValue("IsDelete", StringComparison.OrdinalIgnoreCase, out JToken isDelete)) if (queryObj.TryGetValue("IsDelete", StringComparison.OrdinalIgnoreCase, out JToken isDelete))
exp.And(it => it.IsDelete.Equals(isDelete)); exp.And(it => it.IsDelete.Equals(isDelete));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime) if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
@ -72,11 +76,11 @@ public class CbCameraParamsService : ServiceBase<CbCameraParams>, ITransient
/// <summary> /// <summary>
/// 批量获取分页实体类 /// 批量获取分页实体类
/// </summary> /// </summary>
/// <param name="queryJson">equal:cameraType,isDelete; like:name; between:[startTime,endTime];</param> /// <param name="queryJson">equal:manufactor,type,isDelete; like:name; between:[startTime,endTime];</param>
/// <param name="pagination">index,size</param> /// <param name="pagination">index,size</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public override async Task<List<CbCameraParams>> GetPageList([Required] string pagination, string queryJson="") public override async Task<List<CbCameraParams>> GetPageList([Required] string pagination, string queryJson = "")
{ {
Pagination pageObj = pagination.ToObject<Pagination>(); Pagination pageObj = pagination.ToObject<Pagination>();
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();
@ -84,8 +88,10 @@ public class CbCameraParamsService : ServiceBase<CbCameraParams>, ITransient
var exp = Expressionable.Create<CbCameraParams>(); var exp = Expressionable.Create<CbCameraParams>();
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name)) if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
exp.And(it => it.Name.Contains(name.ToString())); exp.And(it => it.Name.Contains(name.ToString()));
if (queryObj.TryGetValue("cameraType", StringComparison.OrdinalIgnoreCase, out JToken cameraType)) if (queryObj.TryGetValue("manufactor", StringComparison.OrdinalIgnoreCase, out JToken manufactor))
exp.And(it => it.CameraType.Equals(cameraType)); exp.And(it => it.Manufactor.Equals(manufactor));
if (queryObj.TryGetValue("type", StringComparison.OrdinalIgnoreCase, out JToken type))
exp.And(it => it.Type.Equals(type));
if (queryObj.TryGetValue("IsDelete", StringComparison.OrdinalIgnoreCase, out JToken isDelete)) if (queryObj.TryGetValue("IsDelete", StringComparison.OrdinalIgnoreCase, out JToken isDelete))
exp.And(it => it.IsDelete.Equals(isDelete)); exp.And(it => it.IsDelete.Equals(isDelete));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime) if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)

69
Cis.Application/Cb/Service/CbCameraService.cs

@ -9,8 +9,11 @@ namespace Cis.Application.Cb;
[ApiDescriptionSettings(CbInfo.GroupName, Order = CbInfo.CbCameraGroupOrder)] [ApiDescriptionSettings(CbInfo.GroupName, Order = CbInfo.CbCameraGroupOrder)]
public class CbCameraService : ServiceBase<CbCamera>, ITransient public class CbCameraService : ServiceBase<CbCamera>, ITransient
{ {
public CbCameraService(SqlSugarRepository<CbCamera> baseRep) : base(baseRep) protected readonly SqlSugarRepository<CbCameraParams> _cbCameraParamsRep;
public CbCameraService(SqlSugarRepository<CbCamera> baseRep, SqlSugarRepository<CbCameraParams> cbCameraParamsRep) : base(baseRep)
{ {
_cbCameraParamsRep = cbCameraParamsRep;
} }
/// <summary> /// <summary>
@ -19,7 +22,7 @@ public class CbCameraService : ServiceBase<CbCamera>, ITransient
/// <param name="queryJson">equal:cbCameraParamsId,id,isDelete; like:ip,name; between:[startTime,endTime];</param> /// <param name="queryJson">equal:cbCameraParamsId,id,isDelete; like:ip,name; between:[startTime,endTime];</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public override async Task<CbCamera> GetQ([Required] string queryJson) public override async Task<CbCamera> GetByQ([Required] string queryJson)
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();
@ -103,4 +106,66 @@ public class CbCameraService : ServiceBase<CbCamera>, ITransient
.ToPageListAsync(pageObj.Index, pageObj.Size); .ToPageListAsync(pageObj.Index, pageObj.Size);
return list; return list;
} }
#region BO
/// <summary>
/// 获取实体类 BO
/// </summary>
/// <param name="id">实体类 id</param>
/// <returns></returns>
[HttpGet]
public async Task<CbCameraBO> GetBO([Required] long id)
{
CbCamera camera = await _baseRep.GetByIdAsync(id);
if (camera == null) return null;
CbCameraParams cameraParams = await _cbCameraParamsRep.GetByIdAsync(camera.CbCameraParamsId);
if (cameraParams == null) return null;
CbCameraBO bo = CbCameraBO.New(camera.Id, camera, cameraParams);
return bo;
}
/// <summary>
/// 批量获取实体类 BO
/// </summary>
/// <param name="queryJson">equal:cbCameraParamsId,isDelete; like:ip,name; between:[startTime,endTime];</param>
/// <returns></returns>
[HttpGet]
public async Task<List<CbCameraBO>> GetBOList(string queryJson = "")
{
JObject queryObj = queryJson.ToJObject();
var exp = Expressionable.Create<CbCamera>();
if (queryObj.TryGetValue("cbCameraParamsId", StringComparison.OrdinalIgnoreCase, out JToken cbCameraParamsId))
exp.And(it => it.CbCameraParamsId.Equals(cbCameraParamsId));
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
exp.And(it => it.Name.Contains(name.ToString()));
if (queryObj.TryGetValue("ip", StringComparison.OrdinalIgnoreCase, out JToken ip))
exp.And(it => it.Ip.Contains(ip.ToString()));
if (queryObj.TryGetValue("IsDelete", StringComparison.OrdinalIgnoreCase, out JToken isDelete))
exp.And(it => it.IsDelete.Equals(isDelete));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
List<CbCamera> cameraList = await _baseRep.AsQueryable()
.Where(exp.ToExpression())
.ToListAsync();
HashSet<long> paramsIdSet = new();
foreach (var item in cameraList)
paramsIdSet.Add(item.CbCameraParamsId);
List<CbCameraParams> paramsList = await _cbCameraParamsRep.AsQueryable()
.Where(it => paramsIdSet.ToList().Contains(it.Id))
.ToListAsync();
Dictionary<long, CbCameraParams> paramsDict = new();
foreach (var item in paramsList)
paramsDict.Add(item.Id, item);
List<CbCameraBO> boList = new();
foreach (var item in cameraList)
boList.Add(CbCameraBO.New(item.Id, item, paramsDict[item.CbCameraParamsId]));
return boList;
}
#endregion BO
} }

8
Cis.Application/Cis.Application.csproj

@ -18,10 +18,6 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="MathNet.Numerics" Version="5.0.0" /> <PackageReference Include="MathNet.Numerics" Version="5.0.0" />
</ItemGroup> </ItemGroup>
@ -31,4 +27,8 @@
<ProjectReference Include="..\EC.Helper\EC.Helper.csproj" /> <ProjectReference Include="..\EC.Helper\EC.Helper.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Core\Center\" />
</ItemGroup>
</Project> </Project>

75
Cis.Application/Cis.Application.xml

@ -49,6 +49,26 @@
CbCameraParams 表描述 CbCameraParams 表描述
</summary> </summary>
</member> </member>
<member name="T:Cis.Application.Cb.CbCameraBO">
<summary>
相机 BO
</summary>
</member>
<member name="P:Cis.Application.Cb.CbCameraBO.Id">
<summary>
cbCameraId
</summary>
</member>
<member name="P:Cis.Application.Cb.CbCameraBO.CbCamera">
<summary>
cbCamera 实体类
</summary>
</member>
<member name="P:Cis.Application.Cb.CbCameraBO.CbCameraParams">
<summary>
cbCameraParams 实体类
</summary>
</member>
<member name="T:Cis.Application.Cb.CbCamera"> <member name="T:Cis.Application.Cb.CbCamera">
<summary> <summary>
相机表 相机表
@ -89,9 +109,9 @@
名称 名称
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Cb.CbCameraParams.CameraType"> <member name="P:Cis.Application.Cb.CbCameraParams.Manufactor">
<summary> <summary>
相机类型 相机厂商
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Cb.CbCameraParams.SdkPort"> <member name="P:Cis.Application.Cb.CbCameraParams.SdkPort">
@ -99,6 +119,11 @@
sdk 端口 sdk 端口
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Cb.CbCameraParams.Type">
<summary>
相机类型
</summary>
</member>
<member name="P:Cis.Application.Cb.CbCameraParams.FocusX"> <member name="P:Cis.Application.Cb.CbCameraParams.FocusX">
<summary> <summary>
FocusX FocusX
@ -119,25 +144,25 @@
相机参数服务 相机参数服务
</summary> </summary>
</member> </member>
<member name="M:Cis.Application.Cb.CbCameraParamsService.GetQ(System.String)"> <member name="M:Cis.Application.Cb.CbCameraParamsService.GetByQ(System.String)">
<summary> <summary>
获取实体类 获取实体类
</summary> </summary>
<param name="queryJson">equal:cameraType,id,isDelete; like:name; between:[startTime,endTime];</param> <param name="queryJson">equal:manufactor,type,id,isDelete; like:name; between:[startTime,endTime];</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Cis.Application.Cb.CbCameraParamsService.GetList(System.String)"> <member name="M:Cis.Application.Cb.CbCameraParamsService.GetList(System.String)">
<summary> <summary>
批量获取实体类 批量获取实体类
</summary> </summary>
<param name="queryJson">equal:cameraType,isDelete; like:name; between:[startTime,endTime];</param> <param name="queryJson">equal:manufactor,type,isDelete; like:name; between:[startTime,endTime];</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Cis.Application.Cb.CbCameraParamsService.GetPageList(System.String,System.String)"> <member name="M:Cis.Application.Cb.CbCameraParamsService.GetPageList(System.String,System.String)">
<summary> <summary>
批量获取分页实体类 批量获取分页实体类
</summary> </summary>
<param name="queryJson">equal:cameraType,isDelete; like:name; between:[startTime,endTime];</param> <param name="queryJson">equal:manufactor,type,isDelete; like:name; between:[startTime,endTime];</param>
<param name="pagination">index,size</param> <param name="pagination">index,size</param>
<returns></returns> <returns></returns>
</member> </member>
@ -146,7 +171,7 @@
相机服务 相机服务
</summary> </summary>
</member> </member>
<member name="M:Cis.Application.Cb.CbCameraService.GetQ(System.String)"> <member name="M:Cis.Application.Cb.CbCameraService.GetByQ(System.String)">
<summary> <summary>
获取实体类 获取实体类
</summary> </summary>
@ -168,6 +193,20 @@
<param name="pagination">index,size</param> <param name="pagination">index,size</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Cis.Application.Cb.CbCameraService.GetBO(System.Int64)">
<summary>
获取实体类 BO
</summary>
<param name="id">实体类 id</param>
<returns></returns>
</member>
<member name="M:Cis.Application.Cb.CbCameraService.GetBOList(System.String)">
<summary>
批量获取实体类 BO
</summary>
<param name="queryJson">equal:cbCameraParamsId,isDelete; like:ip,name; between:[startTime,endTime];</param>
<returns></returns>
</member>
<member name="T:Cis.Application.Cm.CmInfo"> <member name="T:Cis.Application.Cm.CmInfo">
<summary> <summary>
Cm -> Camera mark Cm -> Camera mark
@ -298,7 +337,7 @@
标记分组服务 标记分组服务
</summary> </summary>
</member> </member>
<member name="M:Cis.Application.Cm.CmMarkGroupService.GetQ(System.String)"> <member name="M:Cis.Application.Cm.CmMarkGroupService.GetByQ(System.String)">
<summary> <summary>
获取实体类 获取实体类
</summary> </summary>
@ -339,14 +378,14 @@
<param name="entity">实体类</param> <param name="entity">实体类</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Cis.Application.Cm.CmMarkLabelService.AddArray(Cis.Application.Cm.CmMarkLabel[])"> <member name="M:Cis.Application.Cm.CmMarkLabelService.AddList(System.Collections.Generic.List{Cis.Application.Cm.CmMarkLabel})">
<summary> <summary>
批量添加实体类 批量添加实体类
</summary> </summary>
<param name="array">实体类数组</param> <param name="list">实体类列表</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Cis.Application.Cm.CmMarkLabelService.GetQ(System.String)"> <member name="M:Cis.Application.Cm.CmMarkLabelService.GetByQ(System.String)">
<summary> <summary>
获取实体类 获取实体类
</summary> </summary>
@ -955,6 +994,11 @@
{cameraId, OnvifClient} {cameraId, OnvifClient}
</summary> </summary>
</member> </member>
<member name="T:Cis.Application.Core.MarkSearchService">
<summary>
标签追踪服务
</summary>
</member>
<member name="M:Cis.Application.Core.MarkSearchService.ActivateSearcher(System.Int64)"> <member name="M:Cis.Application.Core.MarkSearchService.ActivateSearcher(System.Int64)">
<summary> <summary>
激活 Searcher 激活 Searcher
@ -1007,6 +1051,11 @@
<param name="cameraId">cbCameraId</param> <param name="cameraId">cbCameraId</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:Cis.Application.Core.OnvifService">
<summary>
onvif 服务
</summary>
</member>
<member name="M:Cis.Application.Core.OnvifService.Register(System.Int64)"> <member name="M:Cis.Application.Core.OnvifService.Register(System.Int64)">
<summary> <summary>
注册 onvifClient 注册 onvifClient
@ -1244,7 +1293,7 @@
系统字典值服务 系统字典值服务
</summary> </summary>
</member> </member>
<member name="M:Cis.Application.Sys.SysDictDataService.GetQ(System.String)"> <member name="M:Cis.Application.Sys.SysDictDataService.GetByQ(System.String)">
<summary> <summary>
获取实体类 获取实体类
</summary> </summary>
@ -1271,7 +1320,7 @@
系统字典类型服务 系统字典类型服务
</summary> </summary>
</member> </member>
<member name="M:Cis.Application.Sys.SysDictTypeService.GetQ(System.String)"> <member name="M:Cis.Application.Sys.SysDictTypeService.GetByQ(System.String)">
<summary> <summary>
获取实体类 获取实体类
</summary> </summary>

4
Cis.Application/Cm/Service/CmMarkGroupService.cs

@ -19,7 +19,7 @@ public class CmMarkGroupService : ServiceBase<CmMarkGroup>, ITransient
/// <param name="queryJson">equal:id,isDelete; like:name; between:[startTime,endTime];</param> /// <param name="queryJson">equal:id,isDelete; like:name; between:[startTime,endTime];</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public override async Task<CmMarkGroup> GetQ([Required] string queryJson) public override async Task<CmMarkGroup> GetByQ([Required] string queryJson)
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();
@ -72,7 +72,7 @@ public class CmMarkGroupService : ServiceBase<CmMarkGroup>, ITransient
/// <param name="pagination">index,size</param> /// <param name="pagination">index,size</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public override async Task<List<CmMarkGroup>> GetPageList([Required] string pagination, string queryJson="") public override async Task<List<CmMarkGroup>> GetPageList([Required] string pagination, string queryJson = "")
{ {
Pagination pageObj = pagination.ToObject<Pagination>(); Pagination pageObj = pagination.ToObject<Pagination>();
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();

10
Cis.Application/Cm/Service/CmMarkLabelService.cs

@ -54,12 +54,12 @@ public class CmMarkLabelService : ServiceBase<CmMarkLabel>, ITransient
/// <summary> /// <summary>
/// 批量添加实体类 /// 批量添加实体类
/// </summary> /// </summary>
/// <param name="array">实体类数组</param> /// <param name="list">实体类列表</param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public override async Task<bool> AddArray([Required][FromForm] CmMarkLabel[] array) public override async Task<bool> AddList([Required][FromForm] List<CmMarkLabel> list)
{ {
foreach (CmMarkLabel item in array) foreach (CmMarkLabel item in list)
{ {
bool ret = _cameraSdk.TryGetPtzInfoById(item.CbCameraId.ToString(), out PtzInfo ptzInfo); bool ret = _cameraSdk.TryGetPtzInfoById(item.CbCameraId.ToString(), out PtzInfo ptzInfo);
if (!ret) return false; if (!ret) return false;
@ -67,7 +67,7 @@ public class CmMarkLabelService : ServiceBase<CmMarkLabel>, ITransient
item.TiltPosition = ptzInfo.Tilt; item.TiltPosition = ptzInfo.Tilt;
item.ZoomPosition = ptzInfo.Zoom; item.ZoomPosition = ptzInfo.Zoom;
} }
return await _baseRep.InsertRangeAsync(array); return await _baseRep.InsertRangeAsync(list);
} }
/// <summary> /// <summary>
@ -76,7 +76,7 @@ public class CmMarkLabelService : ServiceBase<CmMarkLabel>, ITransient
/// <param name="queryJson">equal:cbCameraId,cmMarkGroupId,id,isDelete; like:name; between:[startTime,endTime];</param> /// <param name="queryJson">equal:cbCameraId,cmMarkGroupId,id,isDelete; like:name; between:[startTime,endTime];</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public override async Task<CmMarkLabel> GetQ([Required] string queryJson) public override async Task<CmMarkLabel> GetByQ([Required] string queryJson)
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();

12
Cis.Application/Core/Center/CameraDataCenter.cs

@ -85,6 +85,8 @@ public class CameraDataCenter : ISingleton
/// https://blog.csdn.net/qq_28368039/article/details/118597396 /// https://blog.csdn.net/qq_28368039/article/details/118597396
/// </summary> /// </summary>
private async Task RefreshCameraPtzInfos() private async Task RefreshCameraPtzInfos()
{
try
{ {
string[] cameraIpList = await _cache.HKeysAsync(CacheInfo.CameraIpCounts); string[] cameraIpList = await _cache.HKeysAsync(CacheInfo.CameraIpCounts);
List<Task> tasks = new(); List<Task> tasks = new();
@ -94,6 +96,10 @@ public class CameraDataCenter : ISingleton
} }
await Task.WhenAny(Task.WhenAll(tasks), Task.Delay(_options.CameraPtz.Timeout)); await Task.WhenAny(Task.WhenAll(tasks), Task.Delay(_options.CameraPtz.Timeout));
} }
catch (Exception e)
{
}
}
/// <summary> /// <summary>
/// 刷新相机 ptz /// 刷新相机 ptz
@ -111,6 +117,8 @@ public class CameraDataCenter : ISingleton
/// 刷新所有 markSearcher /// 刷新所有 markSearcher
/// </summary> /// </summary>
private async Task RefreshMarkSearchers() private async Task RefreshMarkSearchers()
{
try
{ {
string[] cameraIdList = await _cache.HKeysAsync(CacheInfo.CameraId2Ip); string[] cameraIdList = await _cache.HKeysAsync(CacheInfo.CameraId2Ip);
List<Task> tasks = new(); List<Task> tasks = new();
@ -120,6 +128,10 @@ public class CameraDataCenter : ISingleton
} }
await Task.WhenAny(Task.WhenAll(tasks), Task.Delay(_options.CameraPtz.Timeout)); await Task.WhenAny(Task.WhenAll(tasks), Task.Delay(_options.CameraPtz.Timeout));
} }
catch (Exception e)
{
}
}
/// <summary> /// <summary>
/// 刷新 markSearcher /// 刷新 markSearcher

16
Cis.Application/Core/Center/InstanceCenter.cs

@ -0,0 +1,16 @@
namespace Cis.Application.Core;
public static class InstanceCenter
{
static InstanceCenter()
{
// 静态构造函数只执行一次
// 主动注册全局单例服务
App.GetService<CameraDataCenter>(App.RootServices);
}
public static void Init()
{
// 空函数,意在初始化静态构造函数
}
}

20
Cis.Application/Core/Common/Extension.cs

@ -6,24 +6,24 @@ namespace Cis.Application.Core;
[SuppressSniffer] [SuppressSniffer]
public static class Extension public static class Extension
{ {
public static ICameraSDK CreateCameraSDK(this CameraType cameraType, CameraInfo cameraInfo) public static ICameraSDK CreateCameraSDK(this CameraManufactor cameraManufactor, CameraInfo cameraInfo)
{ {
return cameraType switch return cameraManufactor switch
{ {
CameraType.HiK => new HiKSDK(cameraInfo), CameraManufactor.HiK => new HiKSDK(cameraInfo),
CameraType.DaHua => new DaHuaSDK(cameraInfo), CameraManufactor.DaHua => new DaHuaSDK(cameraInfo),
CameraType.YuShi => new YuShiSDK(cameraInfo), CameraManufactor.YuShi => new YuShiSDK(cameraInfo),
_ => null, _ => null,
}; };
} }
public static MarkSearcherBase CreateMarkSearcher(this CameraType cameraType, CameraCalcParams cameraCalcParams) public static MarkSearcherBase CreateMarkSearcher(this CameraManufactor cameraManufactor, CameraCalcParams cameraCalcParams)
{ {
return cameraType switch return cameraManufactor switch
{ {
CameraType.HiK => new HiKMarkSearcher(cameraCalcParams), CameraManufactor.HiK => new HiKMarkSearcher(cameraCalcParams),
CameraType.DaHua => new DaHuaMarkSearcher(cameraCalcParams), CameraManufactor.DaHua => new DaHuaMarkSearcher(cameraCalcParams),
CameraType.YuShi => new YuShiMarkSearcher(cameraCalcParams), CameraManufactor.YuShi => new YuShiMarkSearcher(cameraCalcParams),
_ => null _ => null
}; };
} }

2
Cis.Application/Core/Component/CameraSDK/CameraSdkServer.cs

@ -32,7 +32,7 @@ public class CameraSdkServer : ICameraSdkServer, ISingleton
{ {
bool ret = CameraSdkDict.ContainsKey(cameraInfo.Ip); bool ret = CameraSdkDict.ContainsKey(cameraInfo.Ip);
if (ret) return false; if (ret) return false;
ICameraSDK cameraSDK = ((CameraType)cameraInfo.Type).CreateCameraSDK(cameraInfo); ICameraSDK cameraSDK = ((CameraManufactor)cameraInfo.Manufactor).CreateCameraSDK(cameraInfo);
if (cameraSDK == null) return false; if (cameraSDK == null) return false;
ret = cameraSDK.Init(); ret = cameraSDK.Init();
if (!ret) return false; if (!ret) return false;

4
Cis.Application/Core/Component/MarkSeacher/MarkSearcherServer.cs

@ -87,7 +87,7 @@ public class MarkSearcherServer : IMarkSearcherServer, ISingleton
ret = _cameraSdkServer.IsExists(cbCamera.Ip); ret = _cameraSdkServer.IsExists(cbCamera.Ip);
if (!ret) if (!ret)
{ {
CameraInfo cameraInfo = CameraInfo.New(cbCameraParams.CameraType, cbCamera.Ip, cbCamera.UserName, cbCamera.Password); CameraInfo cameraInfo = CameraInfo.New(cbCameraParams.Manufactor, cbCamera.Ip, cbCamera.UserName, cbCamera.Password);
ret = _cameraSdkServer.Register(cameraInfo); ret = _cameraSdkServer.Register(cameraInfo);
if (!ret) if (!ret)
{ {
@ -105,7 +105,7 @@ public class MarkSearcherServer : IMarkSearcherServer, ISingleton
// 创建相机计算参数 // 创建相机计算参数
CameraCalcParams cameraCalcParams = CameraCalcParams.New(cbCamera.Id, ptzInfo, cbCameraParams.FocusX, cbCameraParams.FocusY, zoomVaryExpr); CameraCalcParams cameraCalcParams = CameraCalcParams.New(cbCamera.Id, ptzInfo, cbCameraParams.FocusX, cbCameraParams.FocusY, zoomVaryExpr);
// 创建 markSearcher // 创建 markSearcher
MarkSearcherBase markSearcher = ((CameraType)cbCameraParams.CameraType).CreateMarkSearcher(cameraCalcParams); MarkSearcherBase markSearcher = ((CameraManufactor)cbCameraParams.Manufactor).CreateMarkSearcher(cameraCalcParams);
if (markSearcher == null) return false; if (markSearcher == null) return false;
// 获取标签列表 // 获取标签列表
List<CmMarkLabel> cmMarkLabelList = _cmMarkLableRep.GetList(u => u.CbCameraId == cameraId); List<CmMarkLabel> cmMarkLabelList = _cmMarkLableRep.GetList(u => u.CbCameraId == cameraId);

2
Cis.Application/Core/Component/Onvif/OnvifServer.cs

@ -38,7 +38,7 @@ public class OnvifServer : IOnvifServer, ISingleton
if (ret) return false; if (ret) return false;
OnvifClient client = new(camera.Ip, camera.UserName, camera.Password); OnvifClient client = new(camera.Ip, camera.UserName, camera.Password);
ret = await client.Init(); ret = await client.Init();
if(!ret) return false; if (!ret) return false;
ret = OnvifClientDict.TryAdd(camera.Id, client); ret = OnvifClientDict.TryAdd(camera.Id, client);
return ret; return ret;
} }

3
Cis.Application/Core/Service/MarkSearchService.cs

@ -2,6 +2,9 @@
namespace Cis.Application.Core; namespace Cis.Application.Core;
/// <summary>
/// 标签追踪服务
/// </summary>
[ApiDescriptionSettings(CoreInfo.GroupName, Order = CoreInfo.MarkSearchGroupOrder)] [ApiDescriptionSettings(CoreInfo.GroupName, Order = CoreInfo.MarkSearchGroupOrder)]
public class MarkSearchService : IDynamicApiController, ITransient public class MarkSearchService : IDynamicApiController, ITransient
{ {

3
Cis.Application/Core/Service/OnvifService.cs

@ -4,6 +4,9 @@ using EC.Helper.Onvif;
namespace Cis.Application.Core; namespace Cis.Application.Core;
/// <summary>
/// onvif 服务
/// </summary>
[ApiDescriptionSettings(CoreInfo.GroupName, Order = CoreInfo.OnvifGroupOrder)] [ApiDescriptionSettings(CoreInfo.GroupName, Order = CoreInfo.OnvifGroupOrder)]
public class OnvifService : IDynamicApiController, ITransient public class OnvifService : IDynamicApiController, ITransient
{ {

1
Cis.Application/Startup.cs

@ -33,5 +33,6 @@ public class Startup : AppStartup
/// <param name="env"></param> /// <param name="env"></param>
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{ {
InstanceCenter.Init();
} }
} }

10
Cis.Application/Sys/SeedData/SysDictDataSeedData.cs

@ -6,13 +6,17 @@ public class SysDictDataSeedData : ISqlSugarEntitySeedData<SysDictData>
{ {
return new SysDictData[] return new SysDictData[]
{ {
new(){Id=358769934100001, SysDictTypeId=358728043100001, Code="HiK", Value="1", Order=100, Remark="海康相机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")}, new(){Id=358769934100001, SysDictTypeId=358728043100001, Code="HiK", Value="1", Order=100, Remark="海康", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100002, SysDictTypeId=358728043100001, Code="DaHua", Value="2", Order=100, Remark="大华相机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")}, new(){Id=358769934100002, SysDictTypeId=358728043100001, Code="DaHua", Value="2", Order=100, Remark="大华", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100003, SysDictTypeId=358728043100001, Code="YuShi", Value="3", Order=100, Remark="宇视相机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")}, new(){Id=358769934100003, SysDictTypeId=358728043100001, Code="YuShi", Value="3", Order=100, Remark="宇视", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100011, SysDictTypeId=358728043100002, Code="HiK", Value="8000", Order=100, Remark="海康sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")}, new(){Id=358769934100011, SysDictTypeId=358728043100002, Code="HiK", Value="8000", Order=100, Remark="海康sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100012, SysDictTypeId=358728043100002, Code="DaHua", Value="37777", Order=100, Remark="大华sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")}, new(){Id=358769934100012, SysDictTypeId=358728043100002, Code="DaHua", Value="37777", Order=100, Remark="大华sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100013, SysDictTypeId=358728043100002, Code="YuShi", Value="8800", Order=100, Remark="宇视sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")}, new(){Id=358769934100013, SysDictTypeId=358728043100002, Code="YuShi", Value="8800", Order=100, Remark="宇视sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100021, SysDictTypeId=358728043100001, Code="BulletCamera", Value="1", Order=100, Remark="枪机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100022, SysDictTypeId=358728043100001, Code="DomeCamera", Value="2", Order=100, Remark="半球机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100023, SysDictTypeId=358728043100001, Code="SpeedDomeCamera", Value="3", Order=100, Remark="球机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
}; };
} }
} }

3
Cis.Application/Sys/SeedData/SysDictTypeSeedData.cs

@ -6,8 +6,9 @@ public class SysDictTypeSeedData : ISqlSugarEntitySeedData<SysDictType>
{ {
return new SysDictType[] 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=358728043100001, Name="相机厂商", Code="camera_manufactor", 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")}, 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")},
new(){ Id=358728043100003, Name="相机类型", Code="camera_type", Order=100, Remark="相机类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
}; };
} }
} }

2
Cis.Application/Sys/Service/SysDictDataService.cs

@ -19,7 +19,7 @@ public class SysDictDataService : ServiceBase<SysDictData>, ITransient
/// <param name="queryJson">equal:sysDictTypeId,code,id,isDelete; between:[startTime,endTime];</param> /// <param name="queryJson">equal:sysDictTypeId,code,id,isDelete; between:[startTime,endTime];</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public override async Task<SysDictData> GetQ([Required] string queryJson) public override async Task<SysDictData> GetByQ([Required] string queryJson)
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();

4
Cis.Application/Sys/Service/SysDictTypeService.cs

@ -19,7 +19,7 @@ public class SysDictTypeService : ServiceBase<SysDictType>, ITransient
/// <param name="queryJson">equal:code,id,isDelete; like:name; between:[startTime,endTime];</param> /// <param name="queryJson">equal:code,id,isDelete; like:name; between:[startTime,endTime];</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public override async Task<SysDictType> GetQ([Required] string queryJson) public override async Task<SysDictType> GetByQ([Required] string queryJson)
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();
@ -76,7 +76,7 @@ public class SysDictTypeService : ServiceBase<SysDictType>, ITransient
/// <param name="pagination">index,size</param> /// <param name="pagination">index,size</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public override async Task<List<SysDictType>> GetPageList([Required] string pagination, string queryJson="") public override async Task<List<SysDictType>> GetPageList([Required] string pagination, string queryJson = "")
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();
Pagination pageObj = pagination.ToObject<Pagination>(); Pagination pageObj = pagination.ToObject<Pagination>();

5
Cis.Core/Cache/CacheSetup.cs

@ -9,13 +9,10 @@ public static class CacheSetup
/// </summary> /// </summary>
/// <param name="services"></param> /// <param name="services"></param>
public static void AddCache(this IServiceCollection services) public static void AddCache(this IServiceCollection services)
{
services.AddSingleton<RedisClient>(options =>
{ {
var redisOptions = App.GetOptions<RedisOptions>(); var redisOptions = App.GetOptions<RedisOptions>();
RedisClient cache = new(redisOptions.ConnectionString); RedisClient cache = new(redisOptions.ConnectionString);
cache.FlushDb(); cache.FlushDb();
return cache; services.AddSingleton<RedisClient>(cache);
});
} }
} }

2
Cis.Core/Cis.Core.csproj

@ -34,6 +34,6 @@
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" /> <PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
</ItemGroup> </ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties coreconfig_1json__JsonSchema="https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json" /></VisualStudio></ProjectExtensions> <ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
</Project> </Project>

28
Cis.Core/Cis.Core.xml

@ -208,11 +208,11 @@
<param name="entity">实体类</param> <param name="entity">实体类</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Cis.Core.Common.ServiceBase`1.AddArray(`0[])"> <member name="M:Cis.Core.Common.ServiceBase`1.AddList(System.Collections.Generic.List{`0})">
<summary> <summary>
批量添加实体类 批量添加实体类
</summary> </summary>
<param name="array">实体类数组</param> <param name="list">实体类列表</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Cis.Core.Common.ServiceBase`1.Update(`0)"> <member name="M:Cis.Core.Common.ServiceBase`1.Update(`0)">
@ -222,6 +222,13 @@
<param name="entity">实体类</param> <param name="entity">实体类</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Cis.Core.Common.ServiceBase`1.UpdateList(System.Collections.Generic.List{`0})">
<summary>
批量更新实体类
</summary>
<param name="list">实体类列表</param>
<returns></returns>
</member>
<member name="M:Cis.Core.Common.ServiceBase`1.Delete(System.Int64)"> <member name="M:Cis.Core.Common.ServiceBase`1.Delete(System.Int64)">
<summary> <summary>
删除实体类 删除实体类
@ -229,6 +236,13 @@
<param name="id">实体类 id</param> <param name="id">实体类 id</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Cis.Core.Common.ServiceBase`1.DeleteArray(System.String)">
<summary>
批量删除实体类
</summary>
<param name="ids">实体类数组</param>
<returns></returns>
</member>
<member name="M:Cis.Core.Common.ServiceBase`1.FakeDelete(System.Int64,System.Boolean)"> <member name="M:Cis.Core.Common.ServiceBase`1.FakeDelete(System.Int64,System.Boolean)">
<summary> <summary>
假删除实体类 假删除实体类
@ -244,7 +258,7 @@
<param name="id">实体类 id</param> <param name="id">实体类 id</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Cis.Core.Common.ServiceBase`1.GetQ(System.String)"> <member name="M:Cis.Core.Common.ServiceBase`1.GetByQ(System.String)">
<summary> <summary>
获取实体类 获取实体类
</summary> </summary>
@ -339,6 +353,14 @@
<param name="Json">字串</param> <param name="Json">字串</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Cis.Core.ObjectExtension.ToSplitObjects(System.String,System.String)">
<summary>
字符串拆分转 object[]
</summary>
<param name="str"></param>
<param name="trimstr">默认英文逗号隔开</param>
<returns></returns>
</member>
<member name="M:Cis.Core.ObjectExtension.IsIgnoreColumn(System.Reflection.PropertyInfo)"> <member name="M:Cis.Core.ObjectExtension.IsIgnoreColumn(System.Reflection.PropertyInfo)">
<summary> <summary>
排除SqlSugar忽略的列 排除SqlSugar忽略的列

21
Cis.Core/Common/Entity/ServiceBase.cs

@ -40,12 +40,12 @@ public class ServiceBase<T> : IDynamicApiController where T : EntityBase, new()
/// <summary> /// <summary>
/// 批量添加实体类 /// 批量添加实体类
/// </summary> /// </summary>
/// <param name="array">实体类数组</param> /// <param name="list">实体类列表</param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public virtual async Task<bool> AddArray([Required][FromForm] T[] array) public virtual async Task<bool> AddList([Required][FromForm] List<T> list)
{ {
return await _baseRep.InsertRangeAsync(array); return await _baseRep.InsertRangeAsync(list);
} }
/// <summary> /// <summary>
@ -62,12 +62,12 @@ public class ServiceBase<T> : IDynamicApiController where T : EntityBase, new()
/// <summary> /// <summary>
/// 批量更新实体类 /// 批量更新实体类
/// </summary> /// </summary>
/// <param name="array">实体类数组</param> /// <param name="list">实体类列表</param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public virtual async Task<bool> UpdateArray([Required][FromForm] T[] array) public virtual async Task<bool> UpdateList([Required][FromForm] List<T> list)
{ {
return await _baseRep.UpdateRangeAsync(array); return await _baseRep.UpdateRangeAsync(list);
} }
/// <summary> /// <summary>
@ -84,12 +84,13 @@ public class ServiceBase<T> : IDynamicApiController where T : EntityBase, new()
/// <summary> /// <summary>
/// 批量删除实体类 /// 批量删除实体类
/// </summary> /// </summary>
/// <param name="array">实体类数组</param> /// <param name="ids">实体类数组</param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public virtual async Task<bool> DeleteArray([Required][FromForm] T[] array) public virtual async Task<bool> DeleteArray([Required][FromForm] string ids)
{ {
return await _baseRep.DeleteByIdsAsync(array); object[] objects = ids.ToSplitObjects();
return await _baseRep.DeleteByIdsAsync(objects);
} }
/// <summary> /// <summary>
@ -124,7 +125,7 @@ public class ServiceBase<T> : IDynamicApiController where T : EntityBase, new()
/// <param name="queryJson">equal:id,isDelete; between:[startTime,endTime];</param> /// <param name="queryJson">equal:id,isDelete; between:[startTime,endTime];</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public virtual async Task<T> GetQ([Required] string queryJson) public virtual async Task<T> GetByQ([Required] string queryJson)
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();

17
Cis.Core/Common/Extension/ObjectExtension.cs

@ -128,6 +128,23 @@ public static class ObjectExtension
return !string.IsNullOrEmpty(Json) ? JObject.Parse(Json.Replace("&nbsp;", "")) : JObject.Parse("{}"); return !string.IsNullOrEmpty(Json) ? JObject.Parse(Json.Replace("&nbsp;", "")) : JObject.Parse("{}");
} }
/// <summary>
/// 字符串拆分转 object[]
/// </summary>
/// <param name="str"></param>
/// <param name="trimstr">默认英文逗号隔开</param>
/// <returns></returns>
public static object[] ToSplitObjects(this string str, string trimstr = ",")
{
var list = str.Split(trimstr.ToArray());
object[] result = new object[list.Length];
for (int i = 0; i < list.Length; i++)
{
result[i] = list[i];
}
return result;
}
/// <summary> /// <summary>
/// 排除SqlSugar忽略的列 /// 排除SqlSugar忽略的列
/// </summary> /// </summary>

4
Cis.Core/CoreConfig.json

@ -4,7 +4,7 @@
{ {
"ConfigId": "Cis", "ConfigId": "Cis",
"DbType": "MySql", // MySqlSqlServerSqliteOraclePostgreSQLDmKdbndpOscarMySqlConnectorAccess "DbType": "MySql", // MySqlSqlServerSqliteOraclePostgreSQLDmKdbndpOscarMySqlConnectorAccess
"ConnectionString": "Data Source=127.0.0.1;port=3306;User ID=root;Password=123456;Database=Cis;pooling=true;sslmode=none;CharSet=utf8;", "ConnectionString": "Data Source=192.168.1.119;port=3306;User ID=root;Password=123456;Database=Cis;pooling=true;sslmode=none;CharSet=utf8;",
//"DbType": "Sqlite", //"DbType": "Sqlite",
//"ConnectionString": "DataSource=./cis.db", //"ConnectionString": "DataSource=./cis.db",
//"DbType": "PostgreSQL", //"DbType": "PostgreSQL",
@ -14,7 +14,7 @@
] ]
}, },
"Redis": { "Redis": {
"ConnectionString": "127.0.0.1:6379,password=123456,defaultDatabase=2" "ConnectionString": "192.168.1.119:6379,password=123456,defaultDatabase=2"
}, },
"AppSettings": { "AppSettings": {
"InjectSpecificationDocument": true // Swagger "InjectSpecificationDocument": true // Swagger

2
Cis.Web.Entry/Program.cs

@ -5,7 +5,7 @@ AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler
// 启动 webServer // 启动 webServer
Serve.Run(RunOptions.Default.AddWebComponent<WebComponent>().WithArgs(args)); Serve.Run(RunOptions.Default.AddWebComponent<WebComponent>().WithArgs(args));
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{ {
Log.Error(sender?.ToString(), e); Log.Error(sender?.ToString(), e);
} }

5
Cis.sln

@ -13,11 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cis.Web.Entry", "Cis.Web.En
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EC.Helper", "EC.Helper\EC.Helper.csproj", "{C2A5AEC8-F4FB-4D57-AE32-80502979FB9E}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EC.Helper", "EC.Helper\EC.Helper.csproj", "{C2A5AEC8-F4FB-4D57-AE32-80502979FB9E}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5D70EBD8-D86C-4F6B-9231-3ED720842298}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU

12
EC.Helper/CameraSDK/Common/CameraException.cs

@ -19,7 +19,7 @@ public class CameraException : Exception
protected class CameraExceptionObj protected class CameraExceptionObj
{ {
public CameraType Type { get; set; } public CameraManufactor Manufactor { get; set; }
public int ErrCode { get; set; } public int ErrCode { get; set; }
@ -27,25 +27,25 @@ public class CameraException : Exception
public override string? ToString() public override string? ToString()
{ {
return $"Type:{Type}, ErrCode:{ErrCode}, ErrMsg:{ErrMsg}"; return $"Manufactor:{Manufactor}, ErrCode:{ErrCode}, ErrMsg:{ErrMsg}";
} }
} }
public static CameraException New(CameraType type, int errCode) public static CameraException New(CameraManufactor manufactor, int errCode)
{ {
CameraExceptionObj obj = new() CameraExceptionObj obj = new()
{ {
Type = type, Manufactor = manufactor,
ErrCode = errCode ErrCode = errCode
}; };
return new CameraException(obj.ToString()); return new CameraException(obj.ToString());
} }
public static CameraException New(CameraType type, int errCode, string errMsg) public static CameraException New(CameraManufactor manufactor, int errCode, string errMsg)
{ {
CameraExceptionObj obj = new() CameraExceptionObj obj = new()
{ {
Type = type, Manufactor = manufactor,
ErrCode = errCode, ErrCode = errCode,
ErrMsg = errMsg ErrMsg = errMsg
}; };

28
EC.Helper/CameraSDK/Common/CameraStruct.cs

@ -8,9 +8,9 @@ public class CameraInfo
#region Attr #region Attr
/// <summary> /// <summary>
/// 相机类型 /// 相机厂商
/// </summary> /// </summary>
public int Type { get; set; } public int Manufactor { get; set; }
/// <summary> /// <summary>
/// ip 地址 /// ip 地址
@ -34,35 +34,35 @@ public class CameraInfo
#endregion Attr #endregion Attr
public static CameraInfo New(int type, string ip, int port, string userName, string password) public static CameraInfo New(int manufactor, string ip, int port, string userName, string password)
{ {
CameraInfo info = new() { Type = type, Ip = ip, Port = port, UserName = userName, Password = password }; CameraInfo info = new() { Manufactor = manufactor, Ip = ip, Port = port, UserName = userName, Password = password };
if (port <= 0) if (port <= 0)
throw new Exception("Camera type not support."); throw new Exception("Camera manufactor not support.");
return info; return info;
} }
public static CameraInfo New(int type, string ip, string userName, string password) public static CameraInfo New(int manufactor, string ip, string userName, string password)
{ {
CameraInfo info = new() { Type = type, Ip = ip, UserName = userName, Password = password }; CameraInfo info = new() { Manufactor = manufactor, Ip = ip, UserName = userName, Password = password };
int port = (CameraType)type switch int port = (CameraManufactor)manufactor switch
{ {
CameraType.HiK => (int)CameraPort.HiK, CameraManufactor.HiK => (int)CameraPort.HiK,
CameraType.DaHua => (int)CameraPort.DaHua, CameraManufactor.DaHua => (int)CameraPort.DaHua,
CameraType.YuShi => (int)CameraPort.YuShi, CameraManufactor.YuShi => (int)CameraPort.YuShi,
_ => -1, _ => -1,
}; };
info.Port = port; info.Port = port;
if (port <= 0) if (port <= 0)
throw new Exception("Camera type not support."); throw new Exception("Camera manufactor not support.");
return info; return info;
} }
} }
/// <summary> /// <summary>
/// 相机类型 /// 相机厂商
/// </summary> /// </summary>
public enum CameraType : int public enum CameraManufactor : int
{ {
HiK = 1, HiK = 1,
DaHua, DaHua,

2
EC.Helper/CameraSDK/DaHua/DaHuaSDK.cs

@ -62,7 +62,7 @@ public class DaHuaSDK : ICameraSDK
uint errCode = (uint)DaHuaOriSDK.CLIENT_GetLastError(); uint errCode = (uint)DaHuaOriSDK.CLIENT_GetLastError();
if (errCode == 0) return; if (errCode == 0) return;
errCode -= 0x80000000; errCode -= 0x80000000;
throw CameraException.New(CameraType.DaHua, (int)errCode); throw CameraException.New(CameraManufactor.DaHua, (int)errCode);
} }
#endregion Base Method #endregion Base Method

2
EC.Helper/CameraSDK/HiK/HiKSDK.cs

@ -48,7 +48,7 @@ public class HiKSDK : ICameraSDK
{ {
uint errCode = HiKOriSDK.NET_DVR_GetLastError(); uint errCode = HiKOriSDK.NET_DVR_GetLastError();
if (errCode == 0) return; if (errCode == 0) return;
throw CameraException.New(CameraType.HiK, (int)errCode); throw CameraException.New(CameraManufactor.HiK, (int)errCode);
} }
#endregion Base Method #endregion Base Method

2
EC.Helper/CameraSDK/YuShi/YuShiSDK.cs

@ -51,7 +51,7 @@ public class YuShiSDK : ICameraSDK
{ {
int errCode = YuShiOriSDK.NETDEV_GetLastError(); int errCode = YuShiOriSDK.NETDEV_GetLastError();
if (errCode == 0) return; if (errCode == 0) return;
throw CameraException.New(CameraType.YuShi, (int)errCode); throw CameraException.New(CameraManufactor.YuShi, (int)errCode);
} }
#endregion Base Method #endregion Base Method

4
EC.Helper/Onvif/OnvifClient.cs

@ -120,7 +120,7 @@ public class OnvifClient
if (string.IsNullOrEmpty(SteamUrl)) if (string.IsNullOrEmpty(SteamUrl))
{ {
MediaUri mediaUri = await Media.GetStreamUriAsync(RtspStreamSetup, ProfileToken); MediaUri mediaUri = await Media.GetStreamUriAsync(RtspStreamSetup, ProfileToken);
SteamUrl = mediaUri.Uri; SteamUrl = mediaUri.Uri.Replace("://", $"://{Username}:{Password}@");
} }
return SteamUrl; return SteamUrl;
} }
@ -130,7 +130,7 @@ public class OnvifClient
if (string.IsNullOrEmpty(SnapshotUrl)) if (string.IsNullOrEmpty(SnapshotUrl))
{ {
MediaUri mediaUri = await Media.GetSnapshotUriAsync(ProfileToken); MediaUri mediaUri = await Media.GetSnapshotUriAsync(ProfileToken);
SnapshotUrl = mediaUri.Uri; SnapshotUrl = mediaUri.Uri.Replace("://", $"://{Username}:{Password}@");
} }
return SnapshotUrl; return SnapshotUrl;
} }

4
Frontend/src/api/cameraMark/markSearchApi.ts

@ -5,7 +5,7 @@ import qs from 'qs';
enum Api { enum Api {
ActivateSearcher = '/markSearch/activateSearcher', ActivateSearcher = '/markSearch/activateSearcher',
DeActiveSearcher = '/markSearch/deActiveSearcher', DeActiveSearcher = '/markSearch/deActiveSearcher',
IsExistSearcher = '/markSearch/isExistSearcher', IsExistsSearcher = '/markSearch/isExistsSearcher',
ActivateMarkLabel = '/markSearch/activateMarkLabel', ActivateMarkLabel = '/markSearch/activateMarkLabel',
DeactivateMarkLabel = '/markSearch/deactivateMarkLabel', DeactivateMarkLabel = '/markSearch/deactivateMarkLabel',
IsExistMarkLabel = '/markSearch/isExistMarkLabel', IsExistMarkLabel = '/markSearch/isExistMarkLabel',
@ -18,7 +18,7 @@ export const ActiveSearcher = (params?: any) => axios.post(CisApiUrl + Api.Activ
export const DeActiveSearcher = (params?: any) => axios.post(CisApiUrl + Api.DeActiveSearcher, qs.stringify(params)) export const DeActiveSearcher = (params?: any) => axios.post(CisApiUrl + Api.DeActiveSearcher, qs.stringify(params))
export const IsExistSearcher = (params?: any) => axios.get(CisApiUrl + Api.IsExistSearcher, {params: params}) export const IsExistSearcher = (params?: any) => axios.get(CisApiUrl + Api.IsExistsSearcher, {params: params})
export const ActivateMarkLabel = (params?: any) => axios.post(CisApiUrl + Api.ActivateMarkLabel, qs.stringify(params)) export const ActivateMarkLabel = (params?: any) => axios.post(CisApiUrl + Api.ActivateMarkLabel, qs.stringify(params))

Loading…
Cancel
Save