diff --git a/Cis.Application/Cb/Service/CbCameraService.cs b/Cis.Application/Cb/Service/CbCameraService.cs index 156e370..a3d61f5 100644 --- a/Cis.Application/Cb/Service/CbCameraService.cs +++ b/Cis.Application/Cb/Service/CbCameraService.cs @@ -15,12 +15,14 @@ public class CbCameraService : IDynamicApiController, ITransient _cbCameraRep = cbCameraRep; } + [HttpGet] public async Task Get(long id) { CbCamera entity = await _cbCameraRep.GetByIdAsync(id); return entity; } + [HttpGet] public async Task> GetList(string queryJson = "") { JObject queryObj = queryJson.ToJObject(); @@ -29,6 +31,7 @@ public class CbCameraService : IDynamicApiController, ITransient return list; } + [HttpGet] public async Task> GetPageList(string queryJson, string pagination) { Pagination pageObj = pagination.ToObject(); @@ -38,16 +41,19 @@ public class CbCameraService : IDynamicApiController, ITransient return list; } + [HttpPost] public async Task Add(CbCamera entity) { await _cbCameraRep.InsertAsync(entity); } + [HttpPost] public async Task Update(CbCamera entity) { await _cbCameraRep.UpdateAsync(entity); } + [HttpPost] public async Task Delete(CbCamera entity) { await _cbCameraRep.DeleteAsync(entity); diff --git a/Cis.Application/Cis.Application.xml b/Cis.Application/Cis.Application.xml index 45840b3..20d2139 100644 --- a/Cis.Application/Cis.Application.xml +++ b/Cis.Application/Cis.Application.xml @@ -134,6 +134,16 @@ 标记标签表 + + + 相机 Id + + + + + 标记组 Id + + 名称 @@ -141,17 +151,17 @@ - Pan 位置 + Pan 坐标 - Tilt 位置 + Tilt 坐标 - Zoom 位置 + Zoom 坐标 @@ -159,45 +169,88 @@ 备注 - + - 相机 Id + 标记分组服务 - + - 标记组 Id + 标记标签服务 - + - 标记分组服务 + 当前相机参数信息 - + - 标记标签服务 + _markLabelInfoList 锁对象,写锁 - + - Ptz 信息 + 需要计算的 markLabelInfo 列表 - + - Pan + 世界坐标转化为相机坐标矩阵 - + - Tilt + 计算标签位置过程 + - + + + 判断相机是否进行了转动,转动了则需要重新计算世界坐标到相机坐标的转换矩阵 + + + + + + + 获取将世界坐标系中的点转化为相机坐标系中的点的转换矩阵 + + + + + + + 获取将相机坐标系中的点转化为世界坐标系中的点的转换矩阵 + + + + + + + 此方法计算在球机zoom值最小的情况下成像矩阵中的 f 本质为获取像元大小 + 尝试方案1:通过计算的方式来获取 + 尝试方案2:通过张友定相机标定的方法来生成成像矩阵中的 f + + + + + 将Pan值转化为角度 + + + + + + 将Tilt转化为角度 + + + + - Zoom + 根据当前zoom值获取相机矩阵参数 + + @@ -209,6 +262,65 @@ Ptz Api + + + (cbCameraId, cbCameraIp) + + + + + (cameraIp, TbPtzCamera) + + + + + (cameraIp, PtzInfo) + + + + + _markSearcherDict 锁对象,写锁 + + + + + (cbCameraId, MarkSearcherBase) + + + + + (cameraId, List(MarkLabelCalcResult)) + + + + + 循环运行 + + + + + 激活 cbCamera 进入运算 + + + + + + + 解除 cbCamera 进入运算 + + + + + + + 是否懒加载 + + + + + 循环间隔,单位毫秒 + + PtzServer选项 @@ -229,6 +341,117 @@ 服务端口 + + + 相机计算信息 + + + + + Camera Id + + + + + Ptz 信息 + + + + + 图像的宽度 + + + + + 图像的高度 + + + + + 最小焦距 + + + + + Ptz 信息 + + + + + Pan 坐标 + + + + + Tilt 坐标 + + + + + Zoom 坐标 + + + + + 标记标签计算信息 + + + + + MarkLabel Id + + + + + Ptz 信息 + + + + + 画布宽度 + + + + + 画布高度 + + + + + 画布 left 距离 + + + + + 画布 top 距离 + + + + + 标记标签计算结果 + + + + + MarkLabel Id + + + + + true 显示(在当前视频画面里面) + false 不显示(不在当前视频画面里面) + + + + + 画布 left 距离 + + + + + 画布 top 距离 + + 配置应用所需服务,在该方法中可以添加应用所需要的功能或服务 diff --git a/Cis.Application/Cm/Service/CmMarkGroupService.cs b/Cis.Application/Cm/Service/CmMarkGroupService.cs index 2cf1302..17ce798 100644 --- a/Cis.Application/Cm/Service/CmMarkGroupService.cs +++ b/Cis.Application/Cm/Service/CmMarkGroupService.cs @@ -15,12 +15,32 @@ public class CmMarkGroupService : IDynamicApiController, ITransient _cmMarkGroupRep = cmMarkGroupRep; } + [HttpPost] + public async Task Add(CmMarkGroup entity) + { + await _cmMarkGroupRep.InsertAsync(entity); + } + + [HttpPost] + public async Task Update(CmMarkGroup entity) + { + await _cmMarkGroupRep.UpdateAsync(entity); + } + + [HttpPost] + public async Task Delete(CmMarkGroup entity) + { + await _cmMarkGroupRep.DeleteAsync(entity); + } + + [HttpGet] public async Task Get(long id) { CmMarkGroup entity = await _cmMarkGroupRep.GetByIdAsync(id); return entity; } + [HttpGet] public async Task> GetList(string queryJson) { JObject queryObj = queryJson.ToJObject(); @@ -29,6 +49,7 @@ public class CmMarkGroupService : IDynamicApiController, ITransient return list; } + [HttpGet] public async Task> GetPageList(string queryJson, string pagination) { Pagination pageObj = pagination.ToObject(); @@ -37,19 +58,4 @@ public class CmMarkGroupService : IDynamicApiController, ITransient .ToPageListAsync(pageObj.Index, pageObj.Size); return list; } - - public async Task Add(CmMarkGroup entity) - { - await _cmMarkGroupRep.InsertAsync(entity); - } - - public async Task Update(CmMarkGroup entity) - { - await _cmMarkGroupRep.UpdateAsync(entity); - } - - public async Task Delete(CmMarkGroup entity) - { - await _cmMarkGroupRep.DeleteAsync(entity); - } } \ No newline at end of file diff --git a/Cis.Application/Cm/Service/CmMarkLabelService.cs b/Cis.Application/Cm/Service/CmMarkLabelService.cs index 3df7e79..4840182 100644 --- a/Cis.Application/Cm/Service/CmMarkLabelService.cs +++ b/Cis.Application/Cm/Service/CmMarkLabelService.cs @@ -15,12 +15,32 @@ public class CmMarkLabelService : IDynamicApiController, ITransient _cmMarkLabelRep = cmMarkLabelRep; } + [HttpPost] + public async Task Add(CmMarkLabel entity) + { + await _cmMarkLabelRep.InsertAsync(entity); + } + + [HttpPost] + public async Task Update(CmMarkLabel entity) + { + await _cmMarkLabelRep.UpdateAsync(entity); + } + + [HttpPost] + public async Task Delete(CmMarkLabel entity) + { + await _cmMarkLabelRep.DeleteAsync(entity); + } + + [HttpGet] public async Task Get(long id) { CmMarkLabel entity = await _cmMarkLabelRep.GetByIdAsync(id); return entity; } + [HttpGet] public async Task> GetList(string queryJson = "") { JObject queryObj = queryJson.ToJObject(); @@ -29,6 +49,7 @@ public class CmMarkLabelService : IDynamicApiController, ITransient return list; } + [HttpGet] public async Task> GetPageList(string queryJson, string pagination) { Pagination pageObj = pagination.ToObject(); @@ -38,18 +59,4 @@ public class CmMarkLabelService : IDynamicApiController, ITransient return list; } - public async Task Add(CmMarkLabel entity) - { - await _cmMarkLabelRep.InsertAsync(entity); - } - - public async Task Update(CmMarkLabel entity) - { - await _cmMarkLabelRep.UpdateAsync(entity); - } - - public async Task Delete(CmMarkLabel entity) - { - await _cmMarkLabelRep.DeleteAsync(entity); - } } \ No newline at end of file diff --git a/Cis.Application/Core/Service/MarkSearchService.cs b/Cis.Application/Core/Service/MarkSearchService.cs index ec6fd1c..5e1105d 100644 --- a/Cis.Application/Core/Service/MarkSearchService.cs +++ b/Cis.Application/Core/Service/MarkSearchService.cs @@ -16,26 +16,31 @@ public class MarkSearchService : IDynamicApiController, ITransient _cameraDataCenter = cameraDataCenter; } + [HttpPost] public async Task ActivateCamera(long cameraId) { return await _cameraDataCenter.ActiveCameraAsync(cameraId); } + [HttpPost] public async Task DeActiveCamera(long cameraId) { return await _cameraDataCenter.DeActiveCameraAsync(cameraId); } + [HttpPost] public async Task AddCameraMarkLabel(long cameraId, long markLabelId) { return await _cameraDataCenter.AddCameraMarkLabelAsync(cameraId, markLabelId); } + [HttpPost] public async Task DeleteCameraMarkLabel(long cameraId, long markLabelId) { return await _cameraDataCenter.DeleteCameraMarkLabelAsync(cameraId, markLabelId); } + [HttpGet] public async Task> GetMarkLabelCalcResultList(long cameraId) { return await _cameraDataCenter.GetMarkLabelCalcResultListAsync(cameraId); diff --git a/Cis.Application/Sys/Service/SysDictDataService.cs b/Cis.Application/Sys/Service/SysDictDataService.cs index 6042140..2f757d4 100644 --- a/Cis.Application/Sys/Service/SysDictDataService.cs +++ b/Cis.Application/Sys/Service/SysDictDataService.cs @@ -15,12 +15,32 @@ public class SysDictDataService : IDynamicApiController, ITransient _sysDictDataRep = sysDictDataRep; } + [HttpPost] + public async Task Add(SysDictData entity) + { + await _sysDictDataRep.InsertAsync(entity); + } + + [HttpPost] + public async Task Update(SysDictData entity) + { + await _sysDictDataRep.UpdateAsync(entity); + } + + [HttpPost] + public async Task Delete(SysDictData entity) + { + await _sysDictDataRep.DeleteAsync(entity); + } + + [HttpGet] public async Task Get(long id) { SysDictData entity = await _sysDictDataRep.GetByIdAsync(id); return entity; } + [HttpGet] public async Task> GetList(string queryJson) { JObject queryObj = queryJson.ToJObject(); @@ -29,6 +49,7 @@ public class SysDictDataService : IDynamicApiController, ITransient return list; } + [HttpGet] public async Task> GetPageList(string queryJson, string pagination) { Pagination pageObj = pagination.ToObject(); @@ -37,19 +58,4 @@ public class SysDictDataService : IDynamicApiController, ITransient .ToPageListAsync(pageObj.Index, pageObj.Size); return list; } - - public async Task Add(SysDictData entity) - { - await _sysDictDataRep.InsertAsync(entity); - } - - public async Task Update(SysDictData entity) - { - await _sysDictDataRep.UpdateAsync(entity); - } - - public async Task Delete(SysDictData entity) - { - await _sysDictDataRep.DeleteAsync(entity); - } } \ No newline at end of file diff --git a/Cis.Application/Sys/Service/SysDictTypeService.cs b/Cis.Application/Sys/Service/SysDictTypeService.cs index 4c9763b..31165d7 100644 --- a/Cis.Application/Sys/Service/SysDictTypeService.cs +++ b/Cis.Application/Sys/Service/SysDictTypeService.cs @@ -16,12 +16,32 @@ public class SysDictTypeService : IDynamicApiController, ITransient _sysDictTypeRep = sysDictTypeRep; } + [HttpPost] + public async Task Add(SysDictType entity) + { + await _sysDictTypeRep.InsertAsync(entity); + } + + [HttpPost] + public async Task Update(SysDictType entity) + { + await _sysDictTypeRep.UpdateAsync(entity); + } + + [HttpPost] + public async Task Delete(SysDictType entity) + { + await _sysDictTypeRep.DeleteAsync(entity); + } + + [HttpGet] public async Task Get(long id) { SysDictType entity = await _sysDictTypeRep.GetByIdAsync(id); return entity; } + [HttpGet] public async Task> GetList(string queryJson) { JObject queryObj = queryJson.ToJObject(); @@ -30,6 +50,7 @@ public class SysDictTypeService : IDynamicApiController, ITransient return list; } + [HttpGet] public async Task> GetPageList(string queryJson, string pagination) { Pagination pageObj = pagination.ToObject(); @@ -39,18 +60,4 @@ public class SysDictTypeService : IDynamicApiController, ITransient return list; } - public async Task Add(SysDictType entity) - { - await _sysDictTypeRep.InsertAsync(entity); - } - - public async Task Update(SysDictType entity) - { - await _sysDictTypeRep.UpdateAsync(entity); - } - - public async Task Delete(SysDictType entity) - { - await _sysDictTypeRep.DeleteAsync(entity); - } } \ No newline at end of file diff --git a/Cis.Application/Tb/Service/TbPtzCameraService.cs b/Cis.Application/Tb/Service/TbPtzCameraService.cs index 724403f..58d0f2d 100644 --- a/Cis.Application/Tb/Service/TbPtzCameraService.cs +++ b/Cis.Application/Tb/Service/TbPtzCameraService.cs @@ -11,12 +11,32 @@ public class TbPtzCameraService : ITransient _tbPtzCameraRep = tbPtzCameraRep; } + [HttpPost] + public async Task Add(TbPtzCamera entity) + { + await _tbPtzCameraRep.InsertAsync(entity); + } + + [HttpPost] + public async Task Update(TbPtzCamera entity) + { + await _tbPtzCameraRep.UpdateAsync(entity); + } + + [HttpPost] + public async Task Delete(TbPtzCamera entity) + { + await _tbPtzCameraRep.DeleteAsync(entity); + } + + [HttpGet] public async Task Get(int id) { TbPtzCamera entity = await _tbPtzCameraRep.GetByIdAsync(id); return entity; } + [HttpGet] public async Task> GetList(string queryJson = "") { JObject queryObj = !string.IsNullOrEmpty(queryJson) ? queryJson.ToJObject() : default; @@ -25,6 +45,7 @@ public class TbPtzCameraService : ITransient return list; } + [HttpGet] public async Task> GetPageList(string pagination, string queryJson = "") { Pagination pageObj = pagination.ToObject(); @@ -33,19 +54,4 @@ public class TbPtzCameraService : ITransient .ToPageListAsync(pageObj.Index, pageObj.Size); return list; } - - public async Task Add(TbPtzCamera entity) - { - await _tbPtzCameraRep.InsertAsync(entity); - } - - public async Task Update(TbPtzCamera entity) - { - await _tbPtzCameraRep.UpdateAsync(entity); - } - - public async Task Delete(TbPtzCamera entity) - { - await _tbPtzCameraRep.DeleteAsync(entity); - } } \ No newline at end of file diff --git a/Cis.Core/CoreConfig.json b/Cis.Core/CoreConfig.json index ac54671..040f27e 100644 --- a/Cis.Core/CoreConfig.json +++ b/Cis.Core/CoreConfig.json @@ -67,8 +67,7 @@ "CorsAccessorSettings": { "WithExposedHeaders": [ "access-token", - "x-access-token", - "environment" + "x-access-token" ] } } \ No newline at end of file diff --git a/Cis.Core/Extension/ObjectExtension.cs b/Cis.Core/Extension/ObjectExtension.cs index 4a85bb6..e50bed7 100644 --- a/Cis.Core/Extension/ObjectExtension.cs +++ b/Cis.Core/Extension/ObjectExtension.cs @@ -125,7 +125,7 @@ public static class ObjectExtension /// public static JObject ToJObject(this string Json) { - return Json == null ? JObject.Parse("{}") : JObject.Parse(Json.Replace(" ", "")); + return string.IsNullOrEmpty(Json) ? JObject.Parse("{}") : JObject.Parse(Json.Replace(" ", "")); } /// diff --git a/Cis.Web.Core/Startup.cs b/Cis.Web.Core/Startup.cs index 5248263..e7de61a 100644 --- a/Cis.Web.Core/Startup.cs +++ b/Cis.Web.Core/Startup.cs @@ -32,6 +32,19 @@ public class Startup : AppStartup services.AddJwt(); // 允许跨域 services.AddCorsAccessor(); + // 添加 https 跨域时请执行以下方法(关键方法 SetIsOriginAllowed),发现 http 和 https 仅能存在一个 跨域 + // 同时启用 http 和 https,猜测需要通过设置 WithOrigins + // 参考 https://furion.baiqian.ltd/docs/cors?_highlight=corsaccessorsettings#165-corsaccessorsettings-%E9%85%8D%E7%BD%AE + // 以及 http://www.manongjc.com/detail/26-gmogyzvnnewpkml.html + //services.AddCors(options => + //{ + // options.AddPolicy("CorsPolicy", opt => opt + // .SetIsOriginAllowed(_ => true) + // .AllowAnyHeader() + // .AllowAnyMethod() + // .AllowCredentials() + // ); + //}); // 远程请求 services.AddRemoteRequest(); // 任务调度 @@ -59,7 +72,7 @@ public class Startup : AppStartup { options.FileNameRule = fileName => string.Format(fileName, DateTime.Now, logLevel.ToString()); // 每天创建一个文件 options.WriteFilter = logMsg => logMsg.LogLevel == logLevel; // 日志级别 - options.HandleWriteError = (writeError) => // 写入失败时启用备用文件 + options.HandleWriteError = (writeError) => // 写入失败时启用备用文件 { writeError.UseRollbackFileName(Path.GetFileNameWithoutExtension(writeError.CurrentFileName) + "-oops" + Path.GetExtension(writeError.CurrentFileName)); }; @@ -100,6 +113,7 @@ public class Startup : AppStartup app.UseRouting(); app.UseCorsAccessor(); + //app.UseCors("CorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); diff --git a/Cis.Web.Entry/Properties/launchSettings.json b/Cis.Web.Entry/Properties/launchSettings.json index 37d1e2f..7a9aa32 100644 --- a/Cis.Web.Entry/Properties/launchSettings.json +++ b/Cis.Web.Entry/Properties/launchSettings.json @@ -1,12 +1,4 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:58595", - "sslPort": 44326 - } - }, +{ "profiles": { "IIS Express": { "commandName": "IISExpress", @@ -16,13 +8,22 @@ } }, "Cis.Web.Entry": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "https://localhost:5001;http://localhost:5000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5000;http://*:5000;" + //"applicationUrl": "https://localhost:5001;https://*:5001;" + } + }, + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:58595", + "sslPort": 44326 } } -} +} \ No newline at end of file